Third-Party: Update zlib and libpng
|
@ -1,35 +1,47 @@
|
||||||
Libpng 1.6.34 - September 29, 2017
|
libpng 1.6.37 - April 14, 2019
|
||||||
|
==============================
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is a public release of libpng, intended for use in production code.
|
||||||
|
|
||||||
Files available for download:
|
|
||||||
|
|
||||||
Source files with LF line endings (for Unix/Linux) and with a
|
Files available for download
|
||||||
"configure" script
|
----------------------------
|
||||||
|
|
||||||
libpng-1.6.34.tar.xz (LZMA-compressed, recommended)
|
Source files with LF line endings (for Unix/Linux):
|
||||||
libpng-1.6.34.tar.gz
|
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
* libpng-1.6.37.tar.xz (LZMA-compressed, recommended)
|
||||||
"configure" script
|
* libpng-1.6.37.tar.gz
|
||||||
|
|
||||||
lpng1634.7z (LZMA-compressed, recommended)
|
Source files with CRLF line endings (for Windows):
|
||||||
lpng1634.zip
|
|
||||||
|
* lp1637.7z (LZMA-compressed, recommended)
|
||||||
|
* lp1637.zip
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
libpng-1.6.34-README.txt
|
* README.md
|
||||||
libpng-1.6.34-LICENSE.txt
|
* LICENSE.md
|
||||||
libpng-1.6.34-*.asc (armored detached GPG signatures)
|
* AUTHORS.md
|
||||||
|
* TRADEMARK.md
|
||||||
|
|
||||||
Changes since the last public release (1.6.33):
|
|
||||||
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
|
|
||||||
test failures.
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Changes since the previous public release (version 1.6.36)
|
||||||
(subscription required; visit
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
* Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
|
||||||
|
* Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
|
||||||
|
* Fixed a memory leak in pngtest.c.
|
||||||
|
* Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
|
||||||
|
contrib/pngminus; refactor.
|
||||||
|
* Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
|
||||||
|
(Contributed by Willem van Schaik)
|
||||||
|
* Fixed a typo in the libpng license v2.
|
||||||
|
(Contributed by Miguel Ojeda)
|
||||||
|
* Added makefiles for AddressSanitizer-enabled builds.
|
||||||
|
* Cleaned up various makefiles.
|
||||||
|
|
||||||
|
|
||||||
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
||||||
|
Subscription is required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe)
|
to subscribe.
|
||||||
or to glennrp at users.sourceforge.net
|
|
||||||
|
|
||||||
Glenn R-P
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
PNG REFERENCE LIBRARY AUTHORS
|
||||||
|
=============================
|
||||||
|
|
||||||
|
This is the list of PNG Reference Library ("libpng") Contributing
|
||||||
|
Authors, for copyright and licensing purposes.
|
||||||
|
|
||||||
|
* Andreas Dilger
|
||||||
|
* Cosmin Truta
|
||||||
|
* Dave Martindale
|
||||||
|
* Eric S. Raymond
|
||||||
|
* Gilles Vollant
|
||||||
|
* Glenn Randers-Pehrson
|
||||||
|
* Greg Roelofs
|
||||||
|
* Guy Eric Schalnat
|
||||||
|
* James Yu
|
||||||
|
* John Bowler
|
||||||
|
* Kevin Bracey
|
||||||
|
* Magnus Holmgren
|
||||||
|
* Mandar Sahastrabuddhe
|
||||||
|
* Mans Rullgard
|
||||||
|
* Matt Sarett
|
||||||
|
* Mike Klein
|
||||||
|
* Paul Schmidt
|
||||||
|
* Sam Bushell
|
||||||
|
* Samuel Williams
|
||||||
|
* Simon-Pierre Cadieux
|
||||||
|
* Tim Wegner
|
||||||
|
* Tom Lane
|
||||||
|
* Tom Tanner
|
||||||
|
* Vadim Barkov
|
||||||
|
* Willem van Schaik
|
||||||
|
* Zhijie Liang
|
||||||
|
* Arm Holdings
|
||||||
|
- Richard Townsend
|
||||||
|
* Google Inc.
|
||||||
|
- Matt Sarett
|
||||||
|
- Mike Klein
|
||||||
|
|
||||||
|
The build projects, the build scripts, the test scripts, and other
|
||||||
|
files in the "projects", "scripts" and "tests" directories, have other
|
||||||
|
copyright owners, but are released under the libpng license.
|
||||||
|
|
||||||
|
Some files in the "contrib" directory, and some tools-generated files
|
||||||
|
that are distributed with libpng, have other copyright owners, and are
|
||||||
|
released under other open source licenses.
|
|
@ -1,4 +1,3 @@
|
||||||
#if 0
|
|
||||||
CHANGES - changes for libpng
|
CHANGES - changes for libpng
|
||||||
|
|
||||||
version 0.1 [March 29, 1995]
|
version 0.1 [March 29, 1995]
|
||||||
|
@ -1454,7 +1453,7 @@ Version 1.2.6beta4 [July 28, 2004]
|
||||||
sequential read support.
|
sequential read support.
|
||||||
Added some "#if PNG_WRITE_SUPPORTED" blocks.
|
Added some "#if PNG_WRITE_SUPPORTED" blocks.
|
||||||
Added #ifdef to remove some redundancy in png_malloc_default().
|
Added #ifdef to remove some redundancy in png_malloc_default().
|
||||||
Use png_malloc instead of png_zalloc to allocate the pallete.
|
Use png_malloc instead of png_zalloc to allocate the palette.
|
||||||
|
|
||||||
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
|
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
|
||||||
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
|
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
|
||||||
|
@ -3259,7 +3258,7 @@ Version 1.5.2beta01 [February 13, 2011]
|
||||||
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
|
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
|
||||||
old VisualC++ preprocessor.
|
old VisualC++ preprocessor.
|
||||||
Turned on interlace handling in png_read_png().
|
Turned on interlace handling in png_read_png().
|
||||||
Fixed gcc pendantic warnings.
|
Fixed gcc pedantic warnings.
|
||||||
Handle longjmp in Cygwin.
|
Handle longjmp in Cygwin.
|
||||||
Fixed png_get_current_row_number() in the interlaced case.
|
Fixed png_get_current_row_number() in the interlaced case.
|
||||||
Cleaned up ALPHA flags and transformations.
|
Cleaned up ALPHA flags and transformations.
|
||||||
|
@ -3359,7 +3358,7 @@ Version 1.5.3beta05 [May 6, 2011]
|
||||||
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
|
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
|
||||||
was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691.
|
was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691.
|
||||||
Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
|
Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
|
||||||
optimization configureable.
|
optimization configurable.
|
||||||
IDAT compression failed if preceded by a compressed text chunk (bug
|
IDAT compression failed if preceded by a compressed text chunk (bug
|
||||||
introduced in libpng-1.5.3beta01-02). This was because the attempt to
|
introduced in libpng-1.5.3beta01-02). This was because the attempt to
|
||||||
reset the zlib stream in png_write_IDAT happened after the first IDAT
|
reset the zlib stream in png_write_IDAT happened after the first IDAT
|
||||||
|
@ -3643,7 +3642,7 @@ Version 1.5.6beta05 [October 12, 2011]
|
||||||
Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
|
Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
|
||||||
|
|
||||||
Version 1.5.6beta06 [October 17, 2011]
|
Version 1.5.6beta06 [October 17, 2011]
|
||||||
Removed two redundant tests for unitialized row.
|
Removed two redundant tests for uninitialized row.
|
||||||
Fixed a relatively harmless memory overwrite in compressed text writing
|
Fixed a relatively harmless memory overwrite in compressed text writing
|
||||||
with a 1 byte zlib buffer.
|
with a 1 byte zlib buffer.
|
||||||
Add ability to call png_read_update_info multiple times to pngvalid.c.
|
Add ability to call png_read_update_info multiple times to pngvalid.c.
|
||||||
|
@ -3689,7 +3688,7 @@ Version 1.5.7beta01 [November 4, 2011]
|
||||||
crash. The pngmem.c implementation of png_malloc() included a cast
|
crash. The pngmem.c implementation of png_malloc() included a cast
|
||||||
to png_size_t which would fail on large allocations on 16-bit systems.
|
to png_size_t which would fail on large allocations on 16-bit systems.
|
||||||
Fix for the preprocessor of the Intel C compiler. The preprocessor
|
Fix for the preprocessor of the Intel C compiler. The preprocessor
|
||||||
splits adjacent @ signs with a space; this changes the concatentation
|
splits adjacent @ signs with a space; this changes the concatenation
|
||||||
token from @-@-@ to PNG_JOIN; that should work with all compiler
|
token from @-@-@ to PNG_JOIN; that should work with all compiler
|
||||||
preprocessors.
|
preprocessors.
|
||||||
Paeth filter speed improvements from work by Siarhei Siamashka. This
|
Paeth filter speed improvements from work by Siarhei Siamashka. This
|
||||||
|
@ -3735,7 +3734,7 @@ Version 1.5.7beta03 [November 17, 2011]
|
||||||
gray (on palette) itself.
|
gray (on palette) itself.
|
||||||
Fixes for C++ compilation using g++ When libpng source is compiled
|
Fixes for C++ compilation using g++ When libpng source is compiled
|
||||||
using g++. The compiler imposes C++ rules on the C source; thus it
|
using g++. The compiler imposes C++ rules on the C source; thus it
|
||||||
is desireable to make the source work with either C or C++ rules
|
is desirable to make the source work with either C or C++ rules
|
||||||
without throwing away useful error information. This change adds
|
without throwing away useful error information. This change adds
|
||||||
png_voidcast to allow C semantic (void*) cases or the corresponding
|
png_voidcast to allow C semantic (void*) cases or the corresponding
|
||||||
C++ static_cast operation, as appropriate.
|
C++ static_cast operation, as appropriate.
|
||||||
|
@ -4061,7 +4060,7 @@ Version 1.6.0beta17 [March 10, 2012]
|
||||||
possible to call png_inflate() incrementally. A warning is no longer
|
possible to call png_inflate() incrementally. A warning is no longer
|
||||||
issued if the language tag or translated keyword in the iTXt chunk
|
issued if the language tag or translated keyword in the iTXt chunk
|
||||||
has zero length.
|
has zero length.
|
||||||
If benign errors are disabled use maximum window on ancilliary inflate.
|
If benign errors are disabled use maximum window on ancillary inflate.
|
||||||
This works round a bug introduced in 1.5.4 where compressed ancillary
|
This works round a bug introduced in 1.5.4 where compressed ancillary
|
||||||
chunks could end up with a too-small windowBits value in the deflate
|
chunks could end up with a too-small windowBits value in the deflate
|
||||||
header.
|
header.
|
||||||
|
@ -4176,7 +4175,7 @@ Version 1.6.0beta27 [August 11, 2012]
|
||||||
declared even though the functions are never actually defined. This
|
declared even though the functions are never actually defined. This
|
||||||
change provides a dummy definition so that the declarations work, yet any
|
change provides a dummy definition so that the declarations work, yet any
|
||||||
implementation will fail to compile because of an incomplete type.
|
implementation will fail to compile because of an incomplete type.
|
||||||
Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of
|
Re-eliminated the use of strcpy() in pngtest.c. An unnecessary use of
|
||||||
strcpy() was accidentally re-introduced in libpng16; this change replaces
|
strcpy() was accidentally re-introduced in libpng16; this change replaces
|
||||||
it with strncpy().
|
it with strncpy().
|
||||||
Eliminated use of png_sizeof(); use sizeof() instead.
|
Eliminated use of png_sizeof(); use sizeof() instead.
|
||||||
|
@ -4309,7 +4308,7 @@ Version 1.6.0beta31 [November 1, 2012]
|
||||||
resulting in VS2010 having to update the files.
|
resulting in VS2010 having to update the files.
|
||||||
Removed non-working ICC profile support code that was mostly added to
|
Removed non-working ICC profile support code that was mostly added to
|
||||||
libpng-1.6.0beta29 and beta30. There was too much code for too little
|
libpng-1.6.0beta29 and beta30. There was too much code for too little
|
||||||
gain; implementing full ICC color correction may be desireable but is left
|
gain; implementing full ICC color correction may be desirable but is left
|
||||||
up to applications.
|
up to applications.
|
||||||
|
|
||||||
Version 1.6.0beta32 [November 25, 2012]
|
Version 1.6.0beta32 [November 25, 2012]
|
||||||
|
@ -4592,7 +4591,7 @@ Version 1.6.3beta07 [June 8, 2013]
|
||||||
the optimizations ('check' vs 'api') are exposed in the public header files
|
the optimizations ('check' vs 'api') are exposed in the public header files
|
||||||
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
|
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
|
||||||
decision about whether or not to use the optimizations.
|
decision about whether or not to use the optimizations.
|
||||||
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
|
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS usage.
|
||||||
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
|
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
|
||||||
on __ARM_NEON__ from configure time to compile time. This breaks symbol
|
on __ARM_NEON__ from configure time to compile time. This breaks symbol
|
||||||
prefixing because the definition of the special png_init_filter_functions
|
prefixing because the definition of the special png_init_filter_functions
|
||||||
|
@ -5635,7 +5634,7 @@ Version 1.6.24beta02 [June 23, 2016]
|
||||||
to All and adds a list of the warnings that need to be turned off. This is
|
to All and adds a list of the warnings that need to be turned off. This is
|
||||||
semi-documentary; the intent is to tell libpng users which warnings have
|
semi-documentary; the intent is to tell libpng users which warnings have
|
||||||
been examined and judged non-fixable at present. The warning about
|
been examined and judged non-fixable at present. The warning about
|
||||||
structure padding is fixable, but it would be a signficant change (moving
|
structure padding is fixable, but it would be a significant change (moving
|
||||||
structure members around).
|
structure members around).
|
||||||
|
|
||||||
Version 1.6.24beta03 [July 4, 2016]
|
Version 1.6.24beta03 [July 4, 2016]
|
||||||
|
@ -5781,7 +5780,7 @@ Version 1.6.28rc01 [January 3, 2017]
|
||||||
Added option to Cmake build allowing a custom location of zlib to be
|
Added option to Cmake build allowing a custom location of zlib to be
|
||||||
specified in a scenario where libpng is being built as a subproject
|
specified in a scenario where libpng is being built as a subproject
|
||||||
alongside zlib by another project (Sam Serrels).
|
alongside zlib by another project (Sam Serrels).
|
||||||
Changed png_ptr->options from a png_byte to png_uint_32, to accomodate
|
Changed png_ptr->options from a png_byte to png_uint_32, to accommodate
|
||||||
up to 16 options.
|
up to 16 options.
|
||||||
|
|
||||||
Version 1.6.28rc02 [January 4, 2017]
|
Version 1.6.28rc02 [January 4, 2017]
|
||||||
|
@ -5932,7 +5931,7 @@ Version 1.6.32beta04 [August 2, 2017]
|
||||||
Update libpng.3 and libpng-manual.txt about eXIf functions.
|
Update libpng.3 and libpng-manual.txt about eXIf functions.
|
||||||
|
|
||||||
Version 1.6.32beta05 [August 2, 2017]
|
Version 1.6.32beta05 [August 2, 2017]
|
||||||
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability.
|
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatibility.
|
||||||
|
|
||||||
Version 1.6.32beta06 [August 2, 2017]
|
Version 1.6.32beta06 [August 2, 2017]
|
||||||
Removed png_get_eXIf_1() and png_set_eXIf_1().
|
Removed png_get_eXIf_1() and png_set_eXIf_1().
|
||||||
|
@ -6038,14 +6037,73 @@ Version 1.6.33 [September 28, 2017]
|
||||||
Add end_info structure and png_read_end() to the libpng fuzzer.
|
Add end_info structure and png_read_end() to the libpng fuzzer.
|
||||||
|
|
||||||
Version 1.6.34 [September 29, 2017]
|
Version 1.6.34 [September 29, 2017]
|
||||||
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
|
Removed contrib/pngsuite/i*.png; some of them caused test failures.
|
||||||
test failures.
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Version 1.6.35beta01 [March 6, 2018]
|
||||||
(subscription required; visit
|
Restored 21 of the contrib/pngsuite/i*.png, which do not cause test
|
||||||
|
failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png.
|
||||||
|
Added calls to png_set_*() transforms commonly used by browsers to
|
||||||
|
the fuzzer.
|
||||||
|
Removed some unnecessary brackets in pngrtran.c
|
||||||
|
Fixed miscellaneous typos (Patch by github user "luzpaz").
|
||||||
|
Change "ASM C" to "C ASM" in CMakeLists.txt
|
||||||
|
Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin)
|
||||||
|
Added hardware optimization directories to zip and 7z distributions.
|
||||||
|
Fixed incorrect bitmask for options.
|
||||||
|
Fixed many spelling typos.
|
||||||
|
|
||||||
|
Version 1.6.35beta02 [March 28, 2018]
|
||||||
|
Make png_get_iCCP consistent with man page (allow compression-type argument
|
||||||
|
to be NULL, bug report by Lenard Szolnoki).
|
||||||
|
|
||||||
|
Version 1.6.35 [July 15, 2018]
|
||||||
|
Replaced the remaining uses of png_size_t with size_t (Cosmin)
|
||||||
|
Fixed the calculation of row_factor in png_check_chunk_length
|
||||||
|
(reported by Thuan Pham in SourceForge issue #278)
|
||||||
|
Added missing parentheses to a macro definition
|
||||||
|
(suggested by "irwir" in GitHub issue #216)
|
||||||
|
|
||||||
|
Version 1.6.36 [December 1, 2018]
|
||||||
|
Optimized png_do_expand_palette for ARM processors.
|
||||||
|
Improved performance by around 10-22% on a recent ARM Chromebook.
|
||||||
|
(Contributed by Richard Townsend, ARM Holdings)
|
||||||
|
Fixed manipulation of machine-specific optimization options.
|
||||||
|
(Contributed by Vicki Pfau)
|
||||||
|
Used memcpy instead of manual pointer arithmetic on Intel SSE2.
|
||||||
|
(Contributed by Samuel Williams)
|
||||||
|
Fixed build errors with MSVC on ARM64.
|
||||||
|
(Contributed by Zhijie Liang)
|
||||||
|
Fixed detection of libm in CMakeLists.
|
||||||
|
(Contributed by Cameron Cawley)
|
||||||
|
Fixed incorrect creation of pkg-config file in CMakeLists.
|
||||||
|
(Contributed by Kyle Bentley)
|
||||||
|
Fixed the CMake build on Windows MSYS by avoiding symlinks.
|
||||||
|
Fixed a build warning on OpenBSD.
|
||||||
|
(Contributed by Theo Buehler)
|
||||||
|
Fixed various typos in comments.
|
||||||
|
(Contributed by "luz.paz")
|
||||||
|
Raised the minimum required CMake version from 3.0.2 to 3.1.
|
||||||
|
Removed yet more of the vestigial support for pre-ANSI C compilers.
|
||||||
|
Removed ancient makefiles for ancient systems that have been broken
|
||||||
|
across all previous libpng-1.6.x versions.
|
||||||
|
Removed the Y2K compliance statement and the export control
|
||||||
|
information.
|
||||||
|
Applied various code style and documentation fixes.
|
||||||
|
|
||||||
|
Version 1.6.37 [April 14, 2019]
|
||||||
|
Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
|
||||||
|
Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
|
||||||
|
Fixed a memory leak in pngtest.c.
|
||||||
|
Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
|
||||||
|
contrib/pngminus; refactor.
|
||||||
|
Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
|
||||||
|
(Contributed by Willem van Schaik)
|
||||||
|
Fixed a typo in the libpng license v2.
|
||||||
|
(Contributed by Miguel Ojeda)
|
||||||
|
Added makefiles for AddressSanitizer-enabled builds.
|
||||||
|
Cleaned up various makefiles.
|
||||||
|
|
||||||
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
||||||
|
Subscription is required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe)
|
to subscribe.
|
||||||
or to glennrp at users.sourceforge.net
|
|
||||||
|
|
||||||
Glenn R-P
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,42 +1,32 @@
|
||||||
# CMakeLists.txt
|
# CMakeLists.txt
|
||||||
|
|
||||||
# Copyright (C) 2007,2009-2017 Glenn Randers-Pehrson
|
# Copyright (C) 2018 Cosmin Truta
|
||||||
|
# Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson
|
||||||
# Written by Christian Ehrlicher, 2007
|
# Written by Christian Ehrlicher, 2007
|
||||||
# Revised by Roger Lowman, 2009-2010
|
# Revised by Roger Lowman, 2009-2010
|
||||||
# Revised by Clifford Yapp, 2011-2012
|
# Revised by Clifford Yapp, 2011-2012,2017
|
||||||
# Revised by Roger Leigh, 2016
|
# Revised by Roger Leigh, 2016
|
||||||
# Revised by Andreas Franek, 2016
|
# Revised by Andreas Franek, 2016
|
||||||
|
# Revised by Sam Serrels, 2017
|
||||||
|
# Revised by Vadim Barkov, 2017
|
||||||
|
# Revised by Vicky Pfau, 2018
|
||||||
|
# Revised by Cameron Cawley, 2018
|
||||||
|
# Revised by Cosmin Truta, 2018
|
||||||
|
# Revised by Kyle Bentley, 2018
|
||||||
|
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
# and license in png.h
|
# and license in png.h
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.0.2)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
cmake_policy(VERSION 3.0.2)
|
cmake_policy(VERSION 3.1)
|
||||||
|
|
||||||
# Set MacOSX @rpath usage globally.
|
project(libpng C ASM)
|
||||||
if (POLICY CMP0020)
|
|
||||||
cmake_policy(SET CMP0020 NEW)
|
|
||||||
endif(POLICY CMP0020)
|
|
||||||
if (POLICY CMP0042)
|
|
||||||
cmake_policy(SET CMP0042 NEW)
|
|
||||||
endif(POLICY CMP0042)
|
|
||||||
# Use new variable expansion policy.
|
|
||||||
if (POLICY CMP0053)
|
|
||||||
cmake_policy(SET CMP0053 NEW)
|
|
||||||
endif(POLICY CMP0053)
|
|
||||||
if (POLICY CMP0054)
|
|
||||||
cmake_policy(SET CMP0054 NEW)
|
|
||||||
endif(POLICY CMP0054)
|
|
||||||
|
|
||||||
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
|
|
||||||
|
|
||||||
project(libpng ASM C)
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
set(PNGLIB_MAJOR 1)
|
set(PNGLIB_MAJOR 1)
|
||||||
set(PNGLIB_MINOR 6)
|
set(PNGLIB_MINOR 6)
|
||||||
set(PNGLIB_RELEASE 34)
|
set(PNGLIB_RELEASE 37)
|
||||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||||
|
|
||||||
|
@ -44,25 +34,19 @@ include(GNUInstallDirs)
|
||||||
|
|
||||||
# needed packages
|
# needed packages
|
||||||
|
|
||||||
#Allow users to specify location of Zlib,
|
# Allow users to specify location of Zlib.
|
||||||
# Useful if zlib is being built alongside this as a sub-project
|
# Useful if zlib is being built alongside this as a sub-project.
|
||||||
option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF)
|
option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF)
|
||||||
|
|
||||||
IF(NOT PNG_BUILD_ZLIB)
|
if(NOT PNG_BUILD_ZLIB)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
include_directories(${ZLIB_INCLUDE_DIR})
|
include_directories(${ZLIB_INCLUDE_DIR})
|
||||||
ENDIF(NOT PNG_BUILD_ZLIB)
|
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
find_library(M_LIBRARY
|
|
||||||
NAMES m
|
|
||||||
PATHS /usr/lib /usr/local/lib
|
|
||||||
)
|
|
||||||
if(NOT M_LIBRARY)
|
|
||||||
message(STATUS "math lib 'libm' not found; floating point support disabled")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
|
||||||
|
find_library(M_LIBRARY m)
|
||||||
else()
|
else()
|
||||||
# not needed on windows
|
# libm is not needed and/or not available
|
||||||
set(M_LIBRARY "")
|
set(M_LIBRARY "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -74,15 +58,13 @@ option(PNG_TESTS "Build libpng tests" ON)
|
||||||
# Many more configuration options could be added here
|
# Many more configuration options could be added here
|
||||||
option(PNG_FRAMEWORK "Build OS X framework" OFF)
|
option(PNG_FRAMEWORK "Build OS X framework" OFF)
|
||||||
option(PNG_DEBUG "Build with debug output" OFF)
|
option(PNG_DEBUG "Build with debug output" OFF)
|
||||||
option(PNGARG "Disable ANSI-C prototypes" OFF)
|
option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" ON)
|
||||||
|
|
||||||
option(PNG_HARDWARE_OPTIMIZATIONS "Enable Hardware Optimizations" ON)
|
|
||||||
|
|
||||||
|
|
||||||
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
|
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
|
||||||
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
|
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
|
||||||
|
|
||||||
if(PNG_HARDWARE_OPTIMIZATIONS)
|
if(PNG_HARDWARE_OPTIMIZATIONS)
|
||||||
|
|
||||||
# set definitions and sources for arm
|
# set definitions and sources for arm
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
||||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
||||||
|
@ -101,7 +83,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
||||||
set(libpng_arm_sources
|
set(libpng_arm_sources
|
||||||
arm/arm_init.c
|
arm/arm_init.c
|
||||||
arm/filter_neon.S
|
arm/filter_neon.S
|
||||||
arm/filter_neon_intrinsics.c)
|
arm/filter_neon_intrinsics.c
|
||||||
|
arm/palette_neon_intrinsics.c)
|
||||||
|
|
||||||
if(${PNG_ARM_NEON} STREQUAL "on")
|
if(${PNG_ARM_NEON} STREQUAL "on")
|
||||||
add_definitions(-DPNG_ARM_NEON_OPT=2)
|
add_definitions(-DPNG_ARM_NEON_OPT=2)
|
||||||
|
@ -184,6 +167,33 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
||||||
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
else(PNG_HARDWARE_OPTIMIZATIONS)
|
||||||
|
|
||||||
|
# set definitions and sources for arm
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
||||||
|
add_definitions(-DPNG_ARM_NEON_OPT=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set definitions and sources for powerpc
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*")
|
||||||
|
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set definitions and sources for intel
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
|
||||||
|
add_definitions(-DPNG_INTEL_SSE_OPT=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# set definitions and sources for MIPS
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
||||||
|
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
|
||||||
|
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
||||||
|
endif()
|
||||||
|
|
||||||
endif(PNG_HARDWARE_OPTIMIZATIONS)
|
endif(PNG_HARDWARE_OPTIMIZATIONS)
|
||||||
|
|
||||||
# SET LIBNAME
|
# SET LIBNAME
|
||||||
|
@ -241,10 +251,10 @@ function(symbol_prefix)
|
||||||
foreach(line ${OUT})
|
foreach(line ${OUT})
|
||||||
string(REGEX MATCH "^PREFIX=" found_match "${line}")
|
string(REGEX MATCH "^PREFIX=" found_match "${line}")
|
||||||
if(found_match)
|
if(found_match)
|
||||||
STRING(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
|
string(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
|
||||||
string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}")
|
string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}")
|
||||||
if(found_match)
|
if(found_match)
|
||||||
STRING(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
|
string(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
|
||||||
endif()
|
endif()
|
||||||
set(SYMBOL_PREFIX "${prefix}")
|
set(SYMBOL_PREFIX "${prefix}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -277,10 +287,10 @@ else()
|
||||||
set(multiValueArgs DEPENDS)
|
set(multiValueArgs DEPENDS)
|
||||||
cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
if(NOT _GC_INPUT)
|
if(NOT _GC_INPUT)
|
||||||
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
|
message(FATAL_ERROR "generate_chk: Missing INPUT argument")
|
||||||
endif()
|
endif()
|
||||||
if(NOT _GC_OUTPUT)
|
if(NOT _GC_OUTPUT)
|
||||||
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
|
message(FATAL_ERROR "generate_chk: Missing OUTPUT argument")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT "${_GC_OUTPUT}"
|
add_custom_command(OUTPUT "${_GC_OUTPUT}"
|
||||||
|
@ -300,10 +310,10 @@ else()
|
||||||
set(multiValueArgs DEPENDS)
|
set(multiValueArgs DEPENDS)
|
||||||
cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
if(NOT _GO_INPUT)
|
if(NOT _GO_INPUT)
|
||||||
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
|
message(FATAL_ERROR "generate_out: Missing INPUT argument")
|
||||||
endif()
|
endif()
|
||||||
if(NOT _GO_OUTPUT)
|
if(NOT _GO_OUTPUT)
|
||||||
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
|
message(FATAL_ERROR "generate_out: Missing OUTPUT argument")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT "${_GO_OUTPUT}"
|
add_custom_command(OUTPUT "${_GO_OUTPUT}"
|
||||||
|
@ -323,7 +333,7 @@ else()
|
||||||
set(multiValueArgs DEPENDS)
|
set(multiValueArgs DEPENDS)
|
||||||
cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
if(NOT _GSO_OUTPUT)
|
if(NOT _GSO_OUTPUT)
|
||||||
message(FATAL_ERROR "Invalid arguments. generate_source requires output.")
|
message(FATAL_ERROR "generate_source: Missing OUTPUT argument")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
|
||||||
|
@ -424,7 +434,7 @@ else()
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
# A single target handles generation of all generated files. If
|
# A single target handles generation of all generated files. If
|
||||||
# they are dependend upon separately by multiple targets, this
|
# they are depended upon separately by multiple targets, this
|
||||||
# confuses parallel make (it would require a separate top-level
|
# confuses parallel make (it would require a separate top-level
|
||||||
# target for each file to track the dependencies properly).
|
# target for each file to track the dependencies properly).
|
||||||
add_custom_target(genfiles DEPENDS
|
add_custom_target(genfiles DEPENDS
|
||||||
|
@ -505,7 +515,7 @@ set(png_fix_itxt_sources
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
endif(MSVC)
|
endif()
|
||||||
|
|
||||||
if(PNG_DEBUG)
|
if(PNG_DEBUG)
|
||||||
add_definitions(-DPNG_DEBUG)
|
add_definitions(-DPNG_DEBUG)
|
||||||
|
@ -599,10 +609,10 @@ function(png_add_test)
|
||||||
cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
if(NOT _PAT_NAME)
|
if(NOT _PAT_NAME)
|
||||||
message(FATAL_ERROR "Invalid arguments. png_add_test requires name.")
|
message(FATAL_ERROR "png_add_test: Missing NAME argument")
|
||||||
endif()
|
endif()
|
||||||
if(NOT _PAT_COMMAND)
|
if(NOT _PAT_COMMAND)
|
||||||
message(FATAL_ERROR "Invalid arguments. png_add_test requires command.")
|
message(FATAL_ERROR "png_add_test: Missing COMMAND argument")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(TEST_OPTIONS "${_PAT_OPTIONS}")
|
set(TEST_OPTIONS "${_PAT_OPTIONS}")
|
||||||
|
@ -610,19 +620,11 @@ function(png_add_test)
|
||||||
|
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in"
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" @ONLY)
|
"${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" @ONLY)
|
||||||
if(CMAKE_MAJOR_VERSION GREATER 2) # have generator expressions
|
|
||||||
add_test(NAME "${_PAT_NAME}"
|
add_test(NAME "${_PAT_NAME}"
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
"-DLIBPNG=$<TARGET_FILE:png>"
|
"-DLIBPNG=$<TARGET_FILE:png>"
|
||||||
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
|
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
|
||||||
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
||||||
else() # old 2.x add_test; limited and won't work well on Windows
|
|
||||||
# Note LIBPNG is a dummy value as there are no generator expressions
|
|
||||||
add_test("${_PAT_NAME}" "${CMAKE_COMMAND}"
|
|
||||||
"-DLIBPNG=${CMAKE_CURRENT_BINARY_DIR}/libpng.so"
|
|
||||||
"-DTEST_COMMAND=./${_PAT_COMMAND}"
|
|
||||||
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
|
||||||
endif()
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(PNG_TESTS AND PNG_SHARED)
|
if(PNG_TESTS AND PNG_SHARED)
|
||||||
|
@ -760,51 +762,44 @@ endif()
|
||||||
# copies if different.
|
# copies if different.
|
||||||
include(CMakeParseArguments)
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
function(CREATE_SYMLINK DEST_FILE)
|
function(create_symlink DEST_FILE)
|
||||||
|
|
||||||
cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN})
|
cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN})
|
||||||
|
|
||||||
if(NOT S_TARGET AND NOT S_FILE)
|
if(NOT S_TARGET AND NOT S_FILE)
|
||||||
message(FATAL_ERROR "Specify either a TARGET or a FILE for CREATE_SYMLINK to link to.")
|
message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument")
|
||||||
endif(NOT S_TARGET AND NOT S_FILE)
|
endif()
|
||||||
|
|
||||||
if(S_TARGET AND S_FILE)
|
if(S_TARGET AND S_FILE)
|
||||||
message(FATAL_ERROR "CREATE_SYMLINK called with both source file ${S_FILE} and build target ${S_TARGET} arguments - can only handle 1 type per call.")
|
message(FATAL_ERROR "create_symlink: Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; can only have one.")
|
||||||
endif(S_TARGET AND S_FILE)
|
endif()
|
||||||
|
|
||||||
if(S_FILE)
|
if(S_FILE)
|
||||||
# If we don't need to symlink something that's coming from a build target,
|
# If we don't need to symlink something that's coming from a build target,
|
||||||
# we can go ahead and symlink/copy at configure time.
|
# we can go ahead and symlink/copy at configure time.
|
||||||
|
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
|
||||||
if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE}
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE}
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
)
|
else()
|
||||||
else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE}
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE}
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
)
|
endif()
|
||||||
endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
endif()
|
||||||
endif(S_FILE)
|
|
||||||
|
|
||||||
if(S_TARGET)
|
if(S_TARGET)
|
||||||
# We need to use generator expressions, which can be a bit tricky, so for
|
# We need to use generator expressions, which can be a bit tricky, so for
|
||||||
# simplicity make the symlink a POST_BUILD step and use the TARGET
|
# simplicity make the symlink a POST_BUILD step and use the TARGET
|
||||||
# signature of add_custom_command.
|
# signature of add_custom_command.
|
||||||
|
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
|
||||||
if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
|
||||||
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE}
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
||||||
)
|
else()
|
||||||
else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
|
||||||
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE}
|
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
||||||
)
|
endif()
|
||||||
endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
endif()
|
||||||
|
|
||||||
endif(S_TARGET)
|
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@ -816,53 +811,43 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
|
||||||
|
|
||||||
|
|
||||||
# libpng is a library so default to 'lib'
|
# libpng is a library so default to 'lib'
|
||||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
set(CMAKE_INSTALL_LIBDIR lib)
|
set(CMAKE_INSTALL_LIBDIR lib)
|
||||||
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
endif()
|
||||||
|
|
||||||
# CREATE PKGCONFIG FILES
|
# CREATE PKGCONFIG FILES
|
||||||
# we use the same files like ./configure, so we have to set its vars
|
# We use the same files like ./configure, so we have to set its vars.
|
||||||
# Only do this on Windows for Cygwin - the files don't make much sense outside
|
# Only do this on Windows for Cygwin - the files don't make much sense outside
|
||||||
# a UNIX look alike
|
# of a UNIX look-alike.
|
||||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||||
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
|
||||||
set(LIBS "-lz -lm")
|
set(LIBS "-lz -lm")
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
||||||
CREATE_SYMLINK(libpng.pc FILE ${PNGLIB_NAME}.pc)
|
create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc)
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
||||||
CREATE_SYMLINK(libpng-config FILE ${PNGLIB_NAME}-config)
|
create_symlink(libpng-config FILE ${PNGLIB_NAME}-config)
|
||||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
endif()
|
||||||
|
|
||||||
# SET UP LINKS
|
# SET UP LINKS
|
||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
set_target_properties(png PROPERTIES
|
set_target_properties(png PROPERTIES
|
||||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.34
|
# VERSION 16.${PNGLIB_RELEASE}.1.6.37
|
||||||
VERSION 16.${PNGLIB_RELEASE}.0
|
VERSION 16.${PNGLIB_RELEASE}.0
|
||||||
SOVERSION 16
|
SOVERSION 16
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If CMake > 2.4.x, we set a variable used below to export
|
|
||||||
# targets to an export file.
|
|
||||||
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
|
|
||||||
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
|
|
||||||
set(PNG_EXPORT_RULE EXPORT libpng)
|
|
||||||
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
|
|
||||||
set(PNG_EXPORT_RULE EXPORT libpng)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# INSTALL
|
# INSTALL
|
||||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
|
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
|
||||||
install(TARGETS ${PNG_LIB_TARGETS}
|
install(TARGETS ${PNG_LIB_TARGETS}
|
||||||
${PNG_EXPORT_RULE}
|
EXPORT libpng
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
@ -871,21 +856,24 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
||||||
if(CYGWIN OR MINGW)
|
if(CYGWIN OR MINGW)
|
||||||
CREATE_SYMLINK(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
|
create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
|
||||||
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||||
endif(CYGWIN OR MINGW)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
CREATE_SYMLINK(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
|
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
|
||||||
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
endif(NOT WIN32)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif(PNG_SHARED)
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(PNG_STATIC)
|
if(PNG_STATIC)
|
||||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
CREATE_SYMLINK( libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static)
|
create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static)
|
||||||
install(FILES $<TARGET_LINKER_FILE_DIR:png_static>/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(FILES $<TARGET_LINKER_FILE_DIR:png_static>/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -896,9 +884,8 @@ endif()
|
||||||
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL)
|
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL)
|
||||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin)
|
||||||
DESTINATION bin)
|
endif()
|
||||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL)
|
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL)
|
||||||
|
@ -923,12 +910,11 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||||
DESTINATION bin)
|
DESTINATION bin)
|
||||||
endif(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW)
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# On versions of CMake that support it, create an export file CMake
|
# Create an export file that CMake users can include() to import our targets.
|
||||||
# users can include() to import our targets
|
if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL)
|
||||||
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
|
|
||||||
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
|
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,7 @@ those sections that are actually used will be loaded into memory.
|
||||||
|
|
||||||
XIV. Enabling or disabling hardware optimizations
|
XIV. Enabling or disabling hardware optimizations
|
||||||
|
|
||||||
Certain hardware capabilites, such as the Intel SSE instructions,
|
Certain hardware capabilities, such as the Intel SSE instructions,
|
||||||
are normally detected at run time. Enable them with configure options
|
are normally detected at run time. Enable them with configure options
|
||||||
such as one of
|
such as one of
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,46 @@
|
||||||
|
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
||||||
|
=========================================
|
||||||
|
|
||||||
This copy of the libpng notices is provided for your convenience. In case of
|
PNG Reference Library License version 2
|
||||||
any discrepancy between this copy and the notices in the file png.h that is
|
---------------------------------------
|
||||||
included in the libpng distribution, the latter shall prevail.
|
|
||||||
|
|
||||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
* Copyright (c) 1995-2019 The PNG Reference Library Authors.
|
||||||
|
* Copyright (c) 2018-2019 Cosmin Truta.
|
||||||
|
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||||
|
* Copyright (c) 1996-1997 Andreas Dilger.
|
||||||
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
||||||
If you modify libpng you may insert additional notices immediately following
|
The software is supplied "as is", without warranty of any kind,
|
||||||
this sentence.
|
express or implied, including, without limitation, the warranties
|
||||||
|
of merchantability, fitness for a particular purpose, title, and
|
||||||
|
non-infringement. In no event shall the Copyright owners, or
|
||||||
|
anyone distributing the software, be liable for any damages or
|
||||||
|
other liability, whether in contract, tort or otherwise, arising
|
||||||
|
from, out of, or in connection with the software, or the use or
|
||||||
|
other dealings in the software, even if advised of the possibility
|
||||||
|
of such damage.
|
||||||
|
|
||||||
This code is released under the libpng license.
|
Permission is hereby granted to use, copy, modify, and distribute
|
||||||
|
this software, or portions hereof, for any purpose, without fee,
|
||||||
|
subject to the following restrictions:
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
1. The origin of this software must not be misrepresented; you
|
||||||
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
must not claim that you wrote the original software. If you
|
||||||
|
use this software in a product, an acknowledgment in the product
|
||||||
|
documentation would be appreciated, but is not required.
|
||||||
|
|
||||||
|
2. Altered source versions must be plainly marked as such, and must
|
||||||
|
not be misrepresented as being the original software.
|
||||||
|
|
||||||
|
3. This Copyright notice may not be removed or altered from any
|
||||||
|
source or altered source distribution.
|
||||||
|
|
||||||
|
|
||||||
|
PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
|
||||||
|
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
|
||||||
derived from libpng-1.0.6, and are distributed according to the same
|
derived from libpng-1.0.6, and are distributed according to the same
|
||||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
added to the list of Contributing Authors:
|
added to the list of Contributing Authors:
|
||||||
|
@ -28,22 +57,22 @@ added to the list of Contributing Authors:
|
||||||
|
|
||||||
and with the following additions to the disclaimer:
|
and with the following additions to the disclaimer:
|
||||||
|
|
||||||
There is no warranty against interference with your enjoyment of the
|
There is no warranty against interference with your enjoyment of
|
||||||
library or against infringement. There is no warranty that our
|
the library or against infringement. There is no warranty that our
|
||||||
efforts or the library will fulfill any of your particular purposes
|
efforts or the library will fulfill any of your particular purposes
|
||||||
or needs. This library is provided with all faults, and the entire
|
or needs. This library is provided with all faults, and the entire
|
||||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
risk of satisfactory quality, performance, accuracy, and effort is
|
||||||
the user.
|
with the user.
|
||||||
|
|
||||||
Some files in the "contrib" directory and some configure-generated
|
Some files in the "contrib" directory and some configure-generated
|
||||||
files that are distributed with libpng have other copyright owners and
|
files that are distributed with libpng have other copyright owners, and
|
||||||
are released under other open source licenses.
|
are released under other open source licenses.
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||||
libpng-0.96, and are distributed according to the same disclaimer and
|
libpng-0.96, and are distributed according to the same disclaimer and
|
||||||
license as libpng-0.96, with the following individuals added to the list
|
license as libpng-0.96, with the following individuals added to the
|
||||||
of Contributing Authors:
|
list of Contributing Authors:
|
||||||
|
|
||||||
Tom Lane
|
Tom Lane
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
|
@ -62,7 +91,7 @@ Contributing Authors:
|
||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
Tom Tanner
|
Tom Tanner
|
||||||
|
|
||||||
Some files in the "scripts" directory have other copyright owners
|
Some files in the "scripts" directory have other copyright owners,
|
||||||
but are released under this license.
|
but are released under this license.
|
||||||
|
|
||||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
|
@ -77,13 +106,14 @@ is defined as the following set of individuals:
|
||||||
Paul Schmidt
|
Paul Schmidt
|
||||||
Tim Wegner
|
Tim Wegner
|
||||||
|
|
||||||
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
The PNG Reference Library is supplied "AS IS". The Contributing
|
||||||
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
Authors and Group 42, Inc. disclaim all warranties, expressed or
|
||||||
including, without limitation, the warranties of merchantability and of
|
implied, including, without limitation, the warranties of
|
||||||
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
merchantability and of fitness for any purpose. The Contributing
|
||||||
assume no liability for direct, indirect, incidental, special, exemplary,
|
Authors and Group 42, Inc. assume no liability for direct, indirect,
|
||||||
or consequential damages, which may result from the use of the PNG
|
incidental, special, exemplary, or consequential damages, which may
|
||||||
Reference Library, even if advised of the possibility of such damage.
|
result from the use of the PNG Reference Library, even if advised of
|
||||||
|
the possibility of such damage.
|
||||||
|
|
||||||
Permission is hereby granted to use, copy, modify, and distribute this
|
Permission is hereby granted to use, copy, modify, and distribute this
|
||||||
source code, or portions hereof, for any purpose, without fee, subject
|
source code, or portions hereof, for any purpose, without fee, subject
|
||||||
|
@ -97,37 +127,8 @@ to the following restrictions:
|
||||||
3. This Copyright notice may not be removed or altered from any
|
3. This Copyright notice may not be removed or altered from any
|
||||||
source or altered source distribution.
|
source or altered source distribution.
|
||||||
|
|
||||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
The Contributing Authors and Group 42, Inc. specifically permit,
|
||||||
fee, and encourage the use of this source code as a component to
|
without fee, and encourage the use of this source code as a component
|
||||||
supporting the PNG file format in commercial products. If you use this
|
to supporting the PNG file format in commercial products. If you use
|
||||||
source code in a product, acknowledgment is not required but would be
|
this source code in a product, acknowledgment is not required but would
|
||||||
appreciated.
|
be appreciated.
|
||||||
|
|
||||||
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
|
||||||
|
|
||||||
TRADEMARK:
|
|
||||||
|
|
||||||
The name "libpng" has not been registered by the Copyright owner
|
|
||||||
as a trademark in any jurisdiction. However, because libpng has
|
|
||||||
been distributed and maintained world-wide, continually since 1995,
|
|
||||||
the Copyright owner claims "common-law trademark protection" in any
|
|
||||||
jurisdiction where common-law trademark is recognized.
|
|
||||||
|
|
||||||
OSI CERTIFICATION:
|
|
||||||
|
|
||||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
|
||||||
a certification mark of the Open Source Initiative. OSI has not addressed
|
|
||||||
the additional disclaimers inserted at version 1.0.7.
|
|
||||||
|
|
||||||
EXPORT CONTROL:
|
|
||||||
|
|
||||||
The Copyright owner believes that the Export Control Classification
|
|
||||||
Number (ECCN) for libpng is EAR99, which means not subject to export
|
|
||||||
controls or International Traffic in Arms Regulations (ITAR) because
|
|
||||||
it is open source, publicly available software, that does not contain
|
|
||||||
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
|
||||||
734.7(b).
|
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
|
||||||
glennrp at users.sourceforge.net
|
|
||||||
September 29, 2017
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2018 Cosmin Truta
|
||||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
# Last changed in libpng 1.6.25 [September 1, 2016]
|
|
||||||
#
|
#
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
@ -95,7 +95,8 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
|
||||||
|
|
||||||
if PNG_ARM_NEON
|
if PNG_ARM_NEON
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
||||||
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
||||||
|
arm/palette_neon_intrinsics.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if PNG_MIPS_MSA
|
if PNG_MIPS_MSA
|
||||||
|
@ -147,7 +148,7 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
||||||
# from those directories being included. This only works if the configure is
|
# from those directories being included. This only works if the configure is
|
||||||
# not done in the source directory!
|
# not done in the source directory!
|
||||||
EXTRA_DIST= \
|
EXTRA_DIST= \
|
||||||
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
|
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
|
||||||
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||||
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||||
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2018 Cosmin Truta
|
||||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
# Last changed in libpng 1.6.25 [September 1, 2016]
|
|
||||||
#
|
#
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
@ -106,7 +106,8 @@ check_PROGRAMS = pngtest$(EXEEXT) pngunknown$(EXEEXT) \
|
||||||
@HAVE_CLOCK_GETTIME_TRUE@am__append_1 = timepng
|
@HAVE_CLOCK_GETTIME_TRUE@am__append_1 = timepng
|
||||||
bin_PROGRAMS = pngfix$(EXEEXT) png-fix-itxt$(EXEEXT)
|
bin_PROGRAMS = pngfix$(EXEEXT) png-fix-itxt$(EXEEXT)
|
||||||
@PNG_ARM_NEON_TRUE@am__append_2 = arm/arm_init.c\
|
@PNG_ARM_NEON_TRUE@am__append_2 = arm/arm_init.c\
|
||||||
@PNG_ARM_NEON_TRUE@ arm/filter_neon.S arm/filter_neon_intrinsics.c
|
@PNG_ARM_NEON_TRUE@ arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
||||||
|
@PNG_ARM_NEON_TRUE@ arm/palette_neon_intrinsics.c
|
||||||
|
|
||||||
@PNG_MIPS_MSA_TRUE@am__append_3 = mips/mips_init.c\
|
@PNG_MIPS_MSA_TRUE@am__append_3 = mips/mips_init.c\
|
||||||
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.c
|
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.c
|
||||||
|
@ -142,6 +143,12 @@ mkinstalldirs = $(install_sh) -d
|
||||||
CONFIG_HEADER = config.h
|
CONFIG_HEADER = config.h
|
||||||
CONFIG_CLEAN_FILES = libpng.pc libpng-config
|
CONFIG_CLEAN_FILES = libpng.pc libpng-config
|
||||||
CONFIG_CLEAN_VPATH_FILES =
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
|
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \
|
||||||
|
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" \
|
||||||
|
"$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" \
|
||||||
|
"$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"
|
||||||
|
@HAVE_CLOCK_GETTIME_TRUE@am__EXEEXT_1 = timepng$(EXEEXT)
|
||||||
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||||
am__vpath_adj = case $$p in \
|
am__vpath_adj = case $$p in \
|
||||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||||
|
@ -169,10 +176,6 @@ am__uninstall_files_from_dir = { \
|
||||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||||
}
|
}
|
||||||
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
|
|
||||||
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" \
|
|
||||||
"$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" \
|
|
||||||
"$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"
|
|
||||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD =
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD =
|
||||||
am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST = png.c \
|
am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST = png.c \
|
||||||
|
@ -181,12 +184,14 @@ am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST = png.c \
|
||||||
pngwtran.c pngwutil.c png.h pngconf.h pngdebug.h pnginfo.h \
|
pngwtran.c pngwutil.c png.h pngconf.h pngdebug.h pnginfo.h \
|
||||||
pngpriv.h pngstruct.h pngusr.dfa arm/arm_init.c \
|
pngpriv.h pngstruct.h pngusr.dfa arm/arm_init.c \
|
||||||
arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
||||||
mips/mips_init.c mips/filter_msa_intrinsics.c \
|
arm/palette_neon_intrinsics.c mips/mips_init.c \
|
||||||
intel/intel_init.c intel/filter_sse2_intrinsics.c \
|
mips/filter_msa_intrinsics.c intel/intel_init.c \
|
||||||
powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c
|
intel/filter_sse2_intrinsics.c powerpc/powerpc_init.c \
|
||||||
|
powerpc/filter_vsx_intrinsics.c
|
||||||
am__dirstamp = $(am__leading_dot)dirstamp
|
am__dirstamp = $(am__leading_dot)dirstamp
|
||||||
@PNG_ARM_NEON_TRUE@am__objects_1 = arm/arm_init.lo arm/filter_neon.lo \
|
@PNG_ARM_NEON_TRUE@am__objects_1 = arm/arm_init.lo arm/filter_neon.lo \
|
||||||
@PNG_ARM_NEON_TRUE@ arm/filter_neon_intrinsics.lo
|
@PNG_ARM_NEON_TRUE@ arm/filter_neon_intrinsics.lo \
|
||||||
|
@PNG_ARM_NEON_TRUE@ arm/palette_neon_intrinsics.lo
|
||||||
@PNG_MIPS_MSA_TRUE@am__objects_2 = mips/mips_init.lo \
|
@PNG_MIPS_MSA_TRUE@am__objects_2 = mips/mips_init.lo \
|
||||||
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.lo
|
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.lo
|
||||||
@PNG_INTEL_SSE_TRUE@am__objects_3 = intel/intel_init.lo \
|
@PNG_INTEL_SSE_TRUE@am__objects_3 = intel/intel_init.lo \
|
||||||
|
@ -211,8 +216,6 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK = $(LIBTOOL) $(AM_V_lt) \
|
||||||
$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS) $(LDFLAGS) -o \
|
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS) $(LDFLAGS) -o \
|
||||||
$@
|
$@
|
||||||
@HAVE_CLOCK_GETTIME_TRUE@am__EXEEXT_1 = timepng$(EXEEXT)
|
|
||||||
PROGRAMS = $(bin_PROGRAMS)
|
|
||||||
am_png_fix_itxt_OBJECTS = contrib/tools/png-fix-itxt.$(OBJEXT)
|
am_png_fix_itxt_OBJECTS = contrib/tools/png-fix-itxt.$(OBJEXT)
|
||||||
png_fix_itxt_OBJECTS = $(am_png_fix_itxt_OBJECTS)
|
png_fix_itxt_OBJECTS = $(am_png_fix_itxt_OBJECTS)
|
||||||
png_fix_itxt_LDADD = $(LDADD)
|
png_fix_itxt_LDADD = $(LDADD)
|
||||||
|
@ -255,11 +258,36 @@ am__v_at_0 = @
|
||||||
am__v_at_1 =
|
am__v_at_1 =
|
||||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
am__depfiles_maybe = depfiles
|
am__maybe_remake_depfiles = depfiles
|
||||||
|
am__depfiles_remade = ./$(DEPDIR)/png.Plo ./$(DEPDIR)/pngerror.Plo \
|
||||||
|
./$(DEPDIR)/pngget.Plo ./$(DEPDIR)/pngmem.Plo \
|
||||||
|
./$(DEPDIR)/pngpread.Plo ./$(DEPDIR)/pngread.Plo \
|
||||||
|
./$(DEPDIR)/pngrio.Plo ./$(DEPDIR)/pngrtran.Plo \
|
||||||
|
./$(DEPDIR)/pngrutil.Plo ./$(DEPDIR)/pngset.Plo \
|
||||||
|
./$(DEPDIR)/pngtest.Po ./$(DEPDIR)/pngtrans.Plo \
|
||||||
|
./$(DEPDIR)/pngwio.Plo ./$(DEPDIR)/pngwrite.Plo \
|
||||||
|
./$(DEPDIR)/pngwtran.Plo ./$(DEPDIR)/pngwutil.Plo \
|
||||||
|
arm/$(DEPDIR)/arm_init.Plo arm/$(DEPDIR)/filter_neon.Plo \
|
||||||
|
arm/$(DEPDIR)/filter_neon_intrinsics.Plo \
|
||||||
|
arm/$(DEPDIR)/palette_neon_intrinsics.Plo \
|
||||||
|
contrib/libtests/$(DEPDIR)/pngimage.Po \
|
||||||
|
contrib/libtests/$(DEPDIR)/pngstest.Po \
|
||||||
|
contrib/libtests/$(DEPDIR)/pngunknown.Po \
|
||||||
|
contrib/libtests/$(DEPDIR)/pngvalid.Po \
|
||||||
|
contrib/libtests/$(DEPDIR)/timepng.Po \
|
||||||
|
contrib/tools/$(DEPDIR)/png-fix-itxt.Po \
|
||||||
|
contrib/tools/$(DEPDIR)/pngcp.Po \
|
||||||
|
contrib/tools/$(DEPDIR)/pngfix.Po \
|
||||||
|
intel/$(DEPDIR)/filter_sse2_intrinsics.Plo \
|
||||||
|
intel/$(DEPDIR)/intel_init.Plo \
|
||||||
|
mips/$(DEPDIR)/filter_msa_intrinsics.Plo \
|
||||||
|
mips/$(DEPDIR)/mips_init.Plo \
|
||||||
|
powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo \
|
||||||
|
powerpc/$(DEPDIR)/powerpc_init.Plo
|
||||||
am__mv = mv -f
|
am__mv = mv -f
|
||||||
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
|
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
|
||||||
LTCPPASCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
|
LTCPPASCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
$(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) \
|
$(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) \
|
||||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||||
$(AM_CCASFLAGS) $(CCASFLAGS)
|
$(AM_CCASFLAGS) $(CCASFLAGS)
|
||||||
|
@ -506,7 +534,7 @@ TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
|
||||||
$(TEST_LOG_FLAGS)
|
$(TEST_LOG_FLAGS)
|
||||||
am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
|
am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
|
||||||
$(srcdir)/config.h.in $(srcdir)/libpng-config.in \
|
$(srcdir)/config.h.in $(srcdir)/libpng-config.in \
|
||||||
$(srcdir)/libpng.pc.in INSTALL README TODO compile \
|
$(srcdir)/libpng.pc.in AUTHORS INSTALL README TODO compile \
|
||||||
config.guess config.sub depcomp install-sh ltmain.sh missing \
|
config.guess config.sub depcomp install-sh ltmain.sh missing \
|
||||||
test-driver
|
test-driver
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
@ -756,7 +784,7 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
||||||
# from those directories being included. This only works if the configure is
|
# from those directories being included. This only works if the configure is
|
||||||
# not done in the source directory!
|
# not done in the source directory!
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
|
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
|
||||||
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||||
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||||
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
||||||
|
@ -814,8 +842,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
echo ' $(SHELL) ./config.status'; \
|
echo ' $(SHELL) ./config.status'; \
|
||||||
$(SHELL) ./config.status;; \
|
$(SHELL) ./config.status;; \
|
||||||
*) \
|
*) \
|
||||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
|
||||||
esac;
|
esac;
|
||||||
|
|
||||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
|
@ -845,83 +873,6 @@ libpng.pc: $(top_builddir)/config.status $(srcdir)/libpng.pc.in
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||||
libpng-config: $(top_builddir)/config.status $(srcdir)/libpng-config.in
|
libpng-config: $(top_builddir)/config.status $(srcdir)/libpng-config.in
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||||
|
|
||||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
|
||||||
@$(NORMAL_INSTALL)
|
|
||||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
|
||||||
list2=; for p in $$list; do \
|
|
||||||
if test -f $$p; then \
|
|
||||||
list2="$$list2 $$p"; \
|
|
||||||
else :; fi; \
|
|
||||||
done; \
|
|
||||||
test -z "$$list2" || { \
|
|
||||||
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
|
|
||||||
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
|
|
||||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
|
||||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
|
||||||
}
|
|
||||||
|
|
||||||
uninstall-libLTLIBRARIES:
|
|
||||||
@$(NORMAL_UNINSTALL)
|
|
||||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
|
||||||
for p in $$list; do \
|
|
||||||
$(am__strip_dir) \
|
|
||||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
|
||||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
clean-libLTLIBRARIES:
|
|
||||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
|
||||||
@list='$(lib_LTLIBRARIES)'; \
|
|
||||||
locs=`for p in $$list; do echo $$p; done | \
|
|
||||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
|
||||||
sort -u`; \
|
|
||||||
test -z "$$locs" || { \
|
|
||||||
echo rm -f $${locs}; \
|
|
||||||
rm -f $${locs}; \
|
|
||||||
}
|
|
||||||
arm/$(am__dirstamp):
|
|
||||||
@$(MKDIR_P) arm
|
|
||||||
@: > arm/$(am__dirstamp)
|
|
||||||
arm/$(DEPDIR)/$(am__dirstamp):
|
|
||||||
@$(MKDIR_P) arm/$(DEPDIR)
|
|
||||||
@: > arm/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
arm/arm_init.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
arm/filter_neon.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
arm/filter_neon_intrinsics.lo: arm/$(am__dirstamp) \
|
|
||||||
arm/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
mips/$(am__dirstamp):
|
|
||||||
@$(MKDIR_P) mips
|
|
||||||
@: > mips/$(am__dirstamp)
|
|
||||||
mips/$(DEPDIR)/$(am__dirstamp):
|
|
||||||
@$(MKDIR_P) mips/$(DEPDIR)
|
|
||||||
@: > mips/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
mips/mips_init.lo: mips/$(am__dirstamp) mips/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
mips/filter_msa_intrinsics.lo: mips/$(am__dirstamp) \
|
|
||||||
mips/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
intel/$(am__dirstamp):
|
|
||||||
@$(MKDIR_P) intel
|
|
||||||
@: > intel/$(am__dirstamp)
|
|
||||||
intel/$(DEPDIR)/$(am__dirstamp):
|
|
||||||
@$(MKDIR_P) intel/$(DEPDIR)
|
|
||||||
@: > intel/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
intel/intel_init.lo: intel/$(am__dirstamp) \
|
|
||||||
intel/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
intel/filter_sse2_intrinsics.lo: intel/$(am__dirstamp) \
|
|
||||||
intel/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
powerpc/$(am__dirstamp):
|
|
||||||
@$(MKDIR_P) powerpc
|
|
||||||
@: > powerpc/$(am__dirstamp)
|
|
||||||
powerpc/$(DEPDIR)/$(am__dirstamp):
|
|
||||||
@$(MKDIR_P) powerpc/$(DEPDIR)
|
|
||||||
@: > powerpc/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
powerpc/powerpc_init.lo: powerpc/$(am__dirstamp) \
|
|
||||||
powerpc/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
powerpc/filter_vsx_intrinsics.lo: powerpc/$(am__dirstamp) \
|
|
||||||
powerpc/$(DEPDIR)/$(am__dirstamp)
|
|
||||||
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la: $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES) $(EXTRA_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES)
|
|
||||||
$(AM_V_CCLD)$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK) -rpath $(libdir) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD) $(LIBS)
|
|
||||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||||
@$(NORMAL_INSTALL)
|
@$(NORMAL_INSTALL)
|
||||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||||
|
@ -980,6 +931,85 @@ clean-checkPROGRAMS:
|
||||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||||
echo " rm -f" $$list; \
|
echo " rm -f" $$list; \
|
||||||
rm -f $$list
|
rm -f $$list
|
||||||
|
|
||||||
|
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||||
|
list2=; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
list2="$$list2 $$p"; \
|
||||||
|
else :; fi; \
|
||||||
|
done; \
|
||||||
|
test -z "$$list2" || { \
|
||||||
|
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
|
||||||
|
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
|
||||||
|
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||||
|
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstall-libLTLIBRARIES:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||||
|
for p in $$list; do \
|
||||||
|
$(am__strip_dir) \
|
||||||
|
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||||
|
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||||
|
done
|
||||||
|
|
||||||
|
clean-libLTLIBRARIES:
|
||||||
|
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||||
|
@list='$(lib_LTLIBRARIES)'; \
|
||||||
|
locs=`for p in $$list; do echo $$p; done | \
|
||||||
|
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||||
|
sort -u`; \
|
||||||
|
test -z "$$locs" || { \
|
||||||
|
echo rm -f $${locs}; \
|
||||||
|
rm -f $${locs}; \
|
||||||
|
}
|
||||||
|
arm/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) arm
|
||||||
|
@: > arm/$(am__dirstamp)
|
||||||
|
arm/$(DEPDIR)/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) arm/$(DEPDIR)
|
||||||
|
@: > arm/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
arm/arm_init.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
arm/filter_neon.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
arm/filter_neon_intrinsics.lo: arm/$(am__dirstamp) \
|
||||||
|
arm/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
arm/palette_neon_intrinsics.lo: arm/$(am__dirstamp) \
|
||||||
|
arm/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
mips/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) mips
|
||||||
|
@: > mips/$(am__dirstamp)
|
||||||
|
mips/$(DEPDIR)/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) mips/$(DEPDIR)
|
||||||
|
@: > mips/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
mips/mips_init.lo: mips/$(am__dirstamp) mips/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
mips/filter_msa_intrinsics.lo: mips/$(am__dirstamp) \
|
||||||
|
mips/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
intel/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) intel
|
||||||
|
@: > intel/$(am__dirstamp)
|
||||||
|
intel/$(DEPDIR)/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) intel/$(DEPDIR)
|
||||||
|
@: > intel/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
intel/intel_init.lo: intel/$(am__dirstamp) \
|
||||||
|
intel/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
intel/filter_sse2_intrinsics.lo: intel/$(am__dirstamp) \
|
||||||
|
intel/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
powerpc/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) powerpc
|
||||||
|
@: > powerpc/$(am__dirstamp)
|
||||||
|
powerpc/$(DEPDIR)/$(am__dirstamp):
|
||||||
|
@$(MKDIR_P) powerpc/$(DEPDIR)
|
||||||
|
@: > powerpc/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
powerpc/powerpc_init.lo: powerpc/$(am__dirstamp) \
|
||||||
|
powerpc/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
powerpc/filter_vsx_intrinsics.lo: powerpc/$(am__dirstamp) \
|
||||||
|
powerpc/$(DEPDIR)/$(am__dirstamp)
|
||||||
|
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la: $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES) $(EXTRA_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES)
|
||||||
|
$(AM_V_CCLD)$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK) -rpath $(libdir) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD) $(LIBS)
|
||||||
contrib/tools/$(am__dirstamp):
|
contrib/tools/$(am__dirstamp):
|
||||||
@$(MKDIR_P) contrib/tools
|
@$(MKDIR_P) contrib/tools
|
||||||
@: > contrib/tools/$(am__dirstamp)
|
@: > contrib/tools/$(am__dirstamp)
|
||||||
|
@ -1097,39 +1127,46 @@ mostlyclean-compile:
|
||||||
distclean-compile:
|
distclean-compile:
|
||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/png.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/png.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngerror.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngerror.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngget.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngget.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngmem.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngmem.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngpread.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngpread.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngread.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngread.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrio.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrio.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrtran.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrtran.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrutil.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngrutil.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngset.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngset.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtest.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtest.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtrans.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngtrans.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwio.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwio.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwrite.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwrite.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwtran.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwtran.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwutil.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngwutil.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/arm_init.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/arm_init.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon_intrinsics.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon_intrinsics.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngimage.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/palette_neon_intrinsics.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngstest.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngimage.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngunknown.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngstest.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngvalid.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngunknown.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/timepng.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngvalid.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/png-fix-itxt.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/timepng.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngcp.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/png-fix-itxt.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngfix.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngcp.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/filter_sse2_intrinsics.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngfix.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/intel_init.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/filter_sse2_intrinsics.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/filter_msa_intrinsics.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/intel_init.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/mips_init.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/filter_msa_intrinsics.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/mips_init.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@powerpc/$(DEPDIR)/powerpc_init.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo@am__quote@ # am--include-marker
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@powerpc/$(DEPDIR)/powerpc_init.Plo@am__quote@ # am--include-marker
|
||||||
|
|
||||||
|
$(am__depfiles_remade):
|
||||||
|
@$(MKDIR_P) $(@D)
|
||||||
|
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||||
|
|
||||||
|
am--depfiles: $(am__depfiles_remade)
|
||||||
|
|
||||||
.S.o:
|
.S.o:
|
||||||
@am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
@am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
||||||
|
@ -1520,7 +1557,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
|
||||||
fi; \
|
fi; \
|
||||||
$$success || exit 1
|
$$success || exit 1
|
||||||
|
|
||||||
check-TESTS:
|
check-TESTS: $(check_PROGRAMS)
|
||||||
@list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
|
@list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
|
||||||
@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
|
@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
|
||||||
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
|
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
|
||||||
|
@ -1787,7 +1824,10 @@ tests/pngimage-full.log: tests/pngimage-full
|
||||||
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
|
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
|
||||||
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
|
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||||
|
|
||||||
distdir: $(DISTFILES)
|
distdir: $(BUILT_SOURCES)
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||||
|
|
||||||
|
distdir-am: $(DISTFILES)
|
||||||
$(am__remove_distdir)
|
$(am__remove_distdir)
|
||||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
|
@ -1830,7 +1870,7 @@ distdir: $(DISTFILES)
|
||||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||||
|| chmod -R a+r "$(distdir)"
|
|| chmod -R a+r "$(distdir)"
|
||||||
dist-gzip: distdir
|
dist-gzip: distdir
|
||||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
|
||||||
$(am__post_remove_distdir)
|
$(am__post_remove_distdir)
|
||||||
|
|
||||||
dist-bzip2: distdir
|
dist-bzip2: distdir
|
||||||
|
@ -1855,7 +1895,7 @@ dist-shar: distdir
|
||||||
@echo WARNING: "Support for shar distribution archives is" \
|
@echo WARNING: "Support for shar distribution archives is" \
|
||||||
"deprecated." >&2
|
"deprecated." >&2
|
||||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
|
||||||
$(am__post_remove_distdir)
|
$(am__post_remove_distdir)
|
||||||
|
|
||||||
dist-zip: distdir
|
dist-zip: distdir
|
||||||
|
@ -1873,7 +1913,7 @@ dist dist-all:
|
||||||
distcheck: dist
|
distcheck: dist
|
||||||
case '$(DIST_ARCHIVES)' in \
|
case '$(DIST_ARCHIVES)' in \
|
||||||
*.tar.gz*) \
|
*.tar.gz*) \
|
||||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||||
*.tar.bz2*) \
|
*.tar.bz2*) \
|
||||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||||
*.tar.lz*) \
|
*.tar.lz*) \
|
||||||
|
@ -1883,7 +1923,7 @@ distcheck: dist
|
||||||
*.tar.Z*) \
|
*.tar.Z*) \
|
||||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||||
*.shar.gz*) \
|
*.shar.gz*) \
|
||||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
|
||||||
*.zip*) \
|
*.zip*) \
|
||||||
unzip $(distdir).zip ;;\
|
unzip $(distdir).zip ;;\
|
||||||
esac
|
esac
|
||||||
|
@ -1957,12 +1997,12 @@ check-am: all-am
|
||||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||||
check: $(BUILT_SOURCES)
|
check: $(BUILT_SOURCES)
|
||||||
$(MAKE) $(AM_MAKEFLAGS) check-am
|
$(MAKE) $(AM_MAKEFLAGS) check-am
|
||||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) \
|
all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(SCRIPTS) $(MANS) $(DATA) \
|
||||||
$(HEADERS) config.h
|
$(HEADERS) config.h
|
||||||
install-binPROGRAMS: install-libLTLIBRARIES
|
install-binPROGRAMS: install-libLTLIBRARIES
|
||||||
|
|
||||||
installdirs:
|
installdirs:
|
||||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"; do \
|
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"; do \
|
||||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||||
done
|
done
|
||||||
install: $(BUILT_SOURCES)
|
install: $(BUILT_SOURCES)
|
||||||
|
@ -2024,7 +2064,40 @@ clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
|
||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-am
|
||||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||||
-rm -rf ./$(DEPDIR) arm/$(DEPDIR) contrib/libtests/$(DEPDIR) contrib/tools/$(DEPDIR) intel/$(DEPDIR) mips/$(DEPDIR) powerpc/$(DEPDIR)
|
-rm -f ./$(DEPDIR)/png.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngerror.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngget.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngmem.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngpread.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngread.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngrio.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngrtran.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngrutil.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngset.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngtest.Po
|
||||||
|
-rm -f ./$(DEPDIR)/pngtrans.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngwio.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngwrite.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngwtran.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngwutil.Plo
|
||||||
|
-rm -f arm/$(DEPDIR)/arm_init.Plo
|
||||||
|
-rm -f arm/$(DEPDIR)/filter_neon.Plo
|
||||||
|
-rm -f arm/$(DEPDIR)/filter_neon_intrinsics.Plo
|
||||||
|
-rm -f arm/$(DEPDIR)/palette_neon_intrinsics.Plo
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/pngimage.Po
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/pngstest.Po
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/pngunknown.Po
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/pngvalid.Po
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/timepng.Po
|
||||||
|
-rm -f contrib/tools/$(DEPDIR)/png-fix-itxt.Po
|
||||||
|
-rm -f contrib/tools/$(DEPDIR)/pngcp.Po
|
||||||
|
-rm -f contrib/tools/$(DEPDIR)/pngfix.Po
|
||||||
|
-rm -f intel/$(DEPDIR)/filter_sse2_intrinsics.Plo
|
||||||
|
-rm -f intel/$(DEPDIR)/intel_init.Plo
|
||||||
|
-rm -f mips/$(DEPDIR)/filter_msa_intrinsics.Plo
|
||||||
|
-rm -f mips/$(DEPDIR)/mips_init.Plo
|
||||||
|
-rm -f powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo
|
||||||
|
-rm -f powerpc/$(DEPDIR)/powerpc_init.Plo
|
||||||
-rm -f Makefile
|
-rm -f Makefile
|
||||||
distclean-am: clean-am distclean-compile distclean-generic \
|
distclean-am: clean-am distclean-compile distclean-generic \
|
||||||
distclean-hdr distclean-libtool distclean-tags
|
distclean-hdr distclean-libtool distclean-tags
|
||||||
|
@ -2076,7 +2149,40 @@ installcheck-am:
|
||||||
maintainer-clean: maintainer-clean-am
|
maintainer-clean: maintainer-clean-am
|
||||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||||
-rm -rf $(top_srcdir)/autom4te.cache
|
-rm -rf $(top_srcdir)/autom4te.cache
|
||||||
-rm -rf ./$(DEPDIR) arm/$(DEPDIR) contrib/libtests/$(DEPDIR) contrib/tools/$(DEPDIR) intel/$(DEPDIR) mips/$(DEPDIR) powerpc/$(DEPDIR)
|
-rm -f ./$(DEPDIR)/png.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngerror.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngget.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngmem.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngpread.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngread.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngrio.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngrtran.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngrutil.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngset.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngtest.Po
|
||||||
|
-rm -f ./$(DEPDIR)/pngtrans.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngwio.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngwrite.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngwtran.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/pngwutil.Plo
|
||||||
|
-rm -f arm/$(DEPDIR)/arm_init.Plo
|
||||||
|
-rm -f arm/$(DEPDIR)/filter_neon.Plo
|
||||||
|
-rm -f arm/$(DEPDIR)/filter_neon_intrinsics.Plo
|
||||||
|
-rm -f arm/$(DEPDIR)/palette_neon_intrinsics.Plo
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/pngimage.Po
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/pngstest.Po
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/pngunknown.Po
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/pngvalid.Po
|
||||||
|
-rm -f contrib/libtests/$(DEPDIR)/timepng.Po
|
||||||
|
-rm -f contrib/tools/$(DEPDIR)/png-fix-itxt.Po
|
||||||
|
-rm -f contrib/tools/$(DEPDIR)/pngcp.Po
|
||||||
|
-rm -f contrib/tools/$(DEPDIR)/pngfix.Po
|
||||||
|
-rm -f intel/$(DEPDIR)/filter_sse2_intrinsics.Plo
|
||||||
|
-rm -f intel/$(DEPDIR)/intel_init.Plo
|
||||||
|
-rm -f mips/$(DEPDIR)/filter_msa_intrinsics.Plo
|
||||||
|
-rm -f mips/$(DEPDIR)/mips_init.Plo
|
||||||
|
-rm -f powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo
|
||||||
|
-rm -f powerpc/$(DEPDIR)/powerpc_init.Plo
|
||||||
-rm -f Makefile
|
-rm -f Makefile
|
||||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
|
@ -2104,19 +2210,19 @@ uninstall-man: uninstall-man3 uninstall-man5
|
||||||
.MAKE: all check check-am install install-am install-data-am \
|
.MAKE: all check check-am install install-am install-data-am \
|
||||||
install-exec-am install-strip uninstall-am
|
install-exec-am install-strip uninstall-am
|
||||||
|
|
||||||
.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-TESTS \
|
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles am--refresh check \
|
||||||
check-am clean clean-binPROGRAMS clean-checkPROGRAMS \
|
check-TESTS check-am clean clean-binPROGRAMS \
|
||||||
clean-cscope clean-generic clean-libLTLIBRARIES clean-libtool \
|
clean-checkPROGRAMS clean-cscope clean-generic \
|
||||||
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
|
clean-libLTLIBRARIES clean-libtool cscope cscopelist-am ctags \
|
||||||
dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \
|
ctags-am dist dist-all dist-bzip2 dist-gzip dist-hook \
|
||||||
dist-zip distcheck distclean distclean-compile \
|
dist-lzip dist-shar dist-tarZ dist-xz dist-zip distcheck \
|
||||||
distclean-generic distclean-hdr distclean-libtool \
|
distclean distclean-compile distclean-generic distclean-hdr \
|
||||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
distclean-libtool distclean-tags distcleancheck distdir \
|
||||||
dvi-am html html-am info info-am install install-am \
|
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||||
install-binPROGRAMS install-binSCRIPTS install-data \
|
install install-am install-binPROGRAMS install-binSCRIPTS \
|
||||||
install-data-am install-data-hook install-dvi install-dvi-am \
|
install-data install-data-am install-data-hook install-dvi \
|
||||||
install-exec install-exec-am install-exec-hook install-html \
|
install-dvi-am install-exec install-exec-am install-exec-hook \
|
||||||
install-html-am install-info install-info-am \
|
install-html install-html-am install-info install-info-am \
|
||||||
install-libLTLIBRARIES install-man install-man3 install-man5 \
|
install-libLTLIBRARIES install-man install-man3 install-man5 \
|
||||||
install-nodist_pkgincludeHEADERS install-pdf install-pdf-am \
|
install-nodist_pkgincludeHEADERS install-pdf install-pdf-am \
|
||||||
install-pkgconfigDATA install-pkgincludeHEADERS install-ps \
|
install-pkgconfigDATA install-pkgincludeHEADERS install-ps \
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
README for libpng version 1.6.34 - September 29, 2017 (shared library 16.0)
|
README for libpng version 1.6.37 - April 14, 2019
|
||||||
See the note about version numbers near the top of png.h
|
=================================================
|
||||||
|
|
||||||
|
See the note about version numbers near the top of png.h.
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|
||||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
|
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
|
||||||
libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
|
libpng-*.tar.xz or if you want UNIX-style line endings in the text
|
||||||
or lpng*.7z or lpng*.zip if you want DOS-style line endings.
|
files, or lpng*.7z or lpng*.zip if you want DOS-style line endings.
|
||||||
|
|
||||||
Version 0.89 was the first official release of libpng. Don't let the
|
Version 0.89 was the first official release of libpng. Don't let the
|
||||||
fact that it's the first release fool you. The libpng library has been in
|
fact that it's the first release fool you. The libpng library has been
|
||||||
extensive use and testing since mid-1995. By late 1997 it had
|
in extensive use and testing since mid-1995. By late 1997 it had
|
||||||
finally gotten to the stage where there hadn't been significant
|
finally gotten to the stage where there hadn't been significant
|
||||||
changes to the API in some time, and people have a bad feeling about
|
changes to the API in some time, and people have a bad feeling about
|
||||||
libraries with versions < 1.0. Version 1.0.0 was released in
|
libraries with versions < 1.0. Version 1.0.0 was released in
|
||||||
|
@ -60,94 +61,59 @@ the library action on the detection of chunk CRC errors. It is possible
|
||||||
to set different actions based on whether the CRC error occurred in a
|
to set different actions based on whether the CRC error occurred in a
|
||||||
critical or an ancillary chunk.
|
critical or an ancillary chunk.
|
||||||
|
|
||||||
The changes made to the library, and bugs fixed are based on discussions
|
For a detailed description on using libpng, read libpng-manual.txt.
|
||||||
on the PNG-implement mailing list and not on material submitted
|
For examples of libpng in a program, see example.c and pngtest.c. For
|
||||||
privately to Guy, Andreas, or Glenn. They will forward any good
|
usage information and restrictions (what little they are) on libpng,
|
||||||
suggestions to the list.
|
see png.h. For a description on using zlib (the compression library
|
||||||
|
used by libpng) and zlib's restrictions, see zlib.h
|
||||||
For a detailed description on using libpng, read libpng-manual.txt. For
|
|
||||||
examples of libpng in a program, see example.c and pngtest.c. For usage
|
|
||||||
information and restrictions (what little they are) on libpng, see
|
|
||||||
png.h. For a description on using zlib (the compression library used by
|
|
||||||
libpng) and zlib's restrictions, see zlib.h
|
|
||||||
|
|
||||||
I have included a general makefile, as well as several machine and
|
I have included a general makefile, as well as several machine and
|
||||||
compiler specific ones, but you may have to modify one for your own needs.
|
compiler specific ones, but you may have to modify one for your own
|
||||||
|
needs.
|
||||||
|
|
||||||
You should use zlib 1.0.4 or later to run this, but it MAY work with
|
You should use zlib 1.0.4 or later to run this, but it MAY work with
|
||||||
versions as old as zlib 0.95. Even so, there are bugs in older zlib
|
versions as old as zlib 0.95. Even so, there are bugs in older zlib
|
||||||
versions which can cause the output of invalid compression streams for
|
versions which can cause the output of invalid compression streams for
|
||||||
some images. You will definitely need zlib 1.0.4 or later if you are
|
some images.
|
||||||
taking advantage of the MS-DOS "far" structure allocation for the small
|
|
||||||
and medium memory models. You should also note that zlib is a
|
|
||||||
compression library that is useful for more things than just PNG files.
|
|
||||||
You can use zlib as a drop-in replacement for fread() and fwrite() if
|
|
||||||
you are so inclined.
|
|
||||||
|
|
||||||
zlib should be available at the same place that libpng is, or at zlib.net.
|
You should also note that zlib is a compression library that is useful
|
||||||
|
for more things than just PNG files. You can use zlib as a drop-in
|
||||||
|
replacement for fread() and fwrite(), if you are so inclined.
|
||||||
|
|
||||||
|
zlib should be available at the same place that libpng is, or at
|
||||||
|
https://zlib.net.
|
||||||
|
|
||||||
You may also want a copy of the PNG specification. It is available
|
You may also want a copy of the PNG specification. It is available
|
||||||
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||||
these at http://www.libpng.org/pub/png/pngdocs.html .
|
these at http://www.libpng.org/pub/png/pngdocs.html .
|
||||||
|
|
||||||
This code is currently being archived at libpng.sourceforge.io in the
|
This code is currently being archived at libpng.sourceforge.io in the
|
||||||
[DOWNLOAD] area, and at http://libpng.download/src . If you
|
[DOWNLOAD] area, and at http://libpng.download/src .
|
||||||
can't find it in any of those places, e-mail me, and I'll help you find it.
|
|
||||||
|
|
||||||
I am not a lawyer, but I believe that the Export Control Classification
|
This release, based in a large way on Glenn's, Guy's and Andreas'
|
||||||
Number (ECCN) for libpng is EAR99, which means not subject to export
|
earlier work, was created and will be supported by myself and the PNG
|
||||||
controls or International Traffic in Arms Regulations (ITAR) because it
|
|
||||||
is open source, publicly available software, that does not contain any
|
|
||||||
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
|
|
||||||
|
|
||||||
If you have any code changes, requests, problems, etc., please e-mail
|
|
||||||
them to me. Also, I'd appreciate any make files or project files,
|
|
||||||
and any modifications you needed to make to get libpng to compile,
|
|
||||||
along with a #define variable to tell what compiler/system you are on.
|
|
||||||
If you needed to add transformations to libpng, or wish libpng would
|
|
||||||
provide the image in a different way, drop me a note (and code, if
|
|
||||||
possible), so I can consider supporting the transformation.
|
|
||||||
Finally, if you get any warning messages when compiling libpng
|
|
||||||
(note: not zlib), and they are easy to fix, I'd appreciate the
|
|
||||||
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
|
||||||
|
|
||||||
This release was created and will be supported by myself (of course
|
|
||||||
based in a large way on Guy's and Andreas' earlier work), and the PNG
|
|
||||||
development group.
|
development group.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at
|
Send comments/corrections/commendations to png-mng-implement at
|
||||||
lists.sourceforge.net (subscription required; visit
|
lists.sourceforge.net (subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe) or to glennrp at users.sourceforge.net
|
to subscribe).
|
||||||
|
|
||||||
You can't reach Guy, the original libpng author, at the addresses
|
Send general questions about the PNG specification to png-mng-misc
|
||||||
given in previous versions of this document. He and Andreas will
|
at lists.sourceforge.net (subscription required; visit
|
||||||
read mail addressed to the png-implement list, however.
|
|
||||||
|
|
||||||
Please do not send general questions about PNG. Send them to
|
|
||||||
png-mng-misc at lists.sf.net (subscription required; visit
|
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
|
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
|
||||||
subscribe). If you have a question about something
|
subscribe).
|
||||||
in the PNG specification that is related to using libpng, send it
|
|
||||||
to me. Send me any questions that start with "I was using libpng,
|
|
||||||
and ...". If in doubt, send questions to me. I'll bounce them
|
|
||||||
to others, if necessary.
|
|
||||||
|
|
||||||
Please do not send suggestions on how to change PNG. We have
|
|
||||||
been discussing PNG for twenty years now, and it is official and
|
|
||||||
finished. If you have suggestions for libpng, however, I'll
|
|
||||||
gladly listen. Even if your suggestion is not used immediately,
|
|
||||||
it may be used later.
|
|
||||||
|
|
||||||
Files in this distribution:
|
Files in this distribution:
|
||||||
|
|
||||||
ANNOUNCE => Announcement of this version, with recent changes
|
ANNOUNCE => Announcement of this version, with recent changes
|
||||||
|
AUTHORS => List of contributing authors
|
||||||
CHANGES => Description of changes between libpng versions
|
CHANGES => Description of changes between libpng versions
|
||||||
KNOWNBUG => List of known bugs and deficiencies
|
KNOWNBUG => List of known bugs and deficiencies
|
||||||
LICENSE => License to use and redistribute libpng
|
LICENSE => License to use and redistribute libpng
|
||||||
README => This file
|
README => This file
|
||||||
TODO => Things not implemented in the current library
|
TODO => Things not implemented in the current library
|
||||||
Y2KINFO => Statement of Y2K compliance
|
TRADEMARK => Trademark information
|
||||||
example.c => Example code for using libpng functions
|
example.c => Example code for using libpng functions
|
||||||
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
||||||
libpng-manual.txt => Description of libpng and its functions
|
libpng-manual.txt => Description of libpng and its functions
|
||||||
|
@ -208,15 +174,10 @@ Files in this distribution:
|
||||||
scripts => Directory containing scripts for building libpng:
|
scripts => Directory containing scripts for building libpng:
|
||||||
(see scripts/README.txt for the list of scripts)
|
(see scripts/README.txt for the list of scripts)
|
||||||
|
|
||||||
Good luck, and happy coding.
|
Good luck, and happy coding!
|
||||||
|
|
||||||
-Glenn Randers-Pehrson (current maintainer, since 1998)
|
* Cosmin Truta (current maintainer, since 2018)
|
||||||
Internet: glennrp at users.sourceforge.net
|
* Glenn Randers-Pehrson (former maintainer, 1998-2018)
|
||||||
|
* Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||||
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
* Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||||
Internet: adilger at enel.ucalgary.ca
|
(formerly of Group 42, Inc.)
|
||||||
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
|
|
||||||
|
|
||||||
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
|
||||||
(formerly of Group 42, Inc)
|
|
||||||
Internet: gschal at infinet.com
|
|
||||||
|
|
|
@ -1,30 +1,23 @@
|
||||||
/*
|
|
||||||
TODO - list of things to do for libpng:
|
TODO - list of things to do for libpng:
|
||||||
|
|
||||||
Final bug fixes.
|
* Fix all defects (duh!)
|
||||||
Better C++ wrapper/full C++ implementation?
|
* Better C++ wrapper / full C++ implementation (?)
|
||||||
Fix problem with C++ and EXTERN "C".
|
* Fix the problems with C++ and 'extern "C"'.
|
||||||
cHRM transformation.
|
* cHRM transformation.
|
||||||
Remove setjmp/longjmp usage in favor of returning error codes. As a start on
|
* Palette creation.
|
||||||
this, minimize the use of png_error(), replacing them with
|
* "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
png_warning(); return(0); or similar.
|
* Improved dithering.
|
||||||
Palette creation.
|
* Multi-lingual error and warning message support.
|
||||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
* Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
|
||||||
Improved dithering.
|
* Man pages for function calls.
|
||||||
Multi-lingual error and warning message support.
|
* Better documentation.
|
||||||
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
* Better filter selection
|
||||||
Man pages for function calls.
|
(e.g., counting huffman bits/precompression; filter inertia; filter costs).
|
||||||
Better documentation.
|
* Histogram creation.
|
||||||
Better filter selection
|
* Text conversion between different code pages (e.g., Latin-1 -> Mac).
|
||||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
* Avoid building gamma tables whenever possible.
|
||||||
Histogram creation.
|
* Greater precision in changing to linear gamma for compositing against
|
||||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
background, and in doing rgb-to-gray transformations.
|
||||||
Avoid building gamma tables whenever possible.
|
* Investigate pre-incremented loop counters and other loop constructions.
|
||||||
Use greater precision when changing to linear gamma for compositing against
|
* Interpolated method of handling interlacing.
|
||||||
background and doing rgb-to-gray transformation.
|
* More validations for libpng transformations.
|
||||||
Investigate pre-incremented loop counters and other loop constructions.
|
|
||||||
Add interpolated method of handling interlacing.
|
|
||||||
Extend pngvalid.c to validate more of the libpng transformations.
|
|
||||||
Refactor preprocessor conditionals to compile entire statements
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
TRADEMARK
|
||||||
|
=========
|
||||||
|
|
||||||
|
The name "libpng" has not been registered by the Copyright owners
|
||||||
|
as a trademark in any jurisdiction. However, because libpng has
|
||||||
|
been distributed and maintained world-wide, continually since 1995,
|
||||||
|
the Copyright owners claim "common-law trademark protection" in any
|
||||||
|
jurisdiction where common-law trademark is recognized.
|
|
@ -1,6 +1,6 @@
|
||||||
# generated automatically by aclocal 1.15 -*- Autoconf -*-
|
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
|
||||||
If you have problems, you may need to regenerate the build system entirely.
|
If you have problems, you may need to regenerate the build system entirely.
|
||||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||||
|
|
||||||
# Copyright (C) 2002-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
|
||||||
# generated from the m4 files accompanying Automake X.Y.
|
# generated from the m4 files accompanying Automake X.Y.
|
||||||
# (This private macro should not be called outside this file.)
|
# (This private macro should not be called outside this file.)
|
||||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||||
[am__api_version='1.15'
|
[am__api_version='1.16'
|
||||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||||
dnl require some minimum version. Point them to the right macro.
|
dnl require some minimum version. Point them to the right macro.
|
||||||
m4_if([$1], [1.15], [],
|
m4_if([$1], [1.16.1], [],
|
||||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||||
[AM_AUTOMAKE_VERSION([1.15])dnl
|
[AM_AUTOMAKE_VERSION([1.16.1])dnl
|
||||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||||
|
|
||||||
# Figure out how to run the assembler. -*- Autoconf -*-
|
# Figure out how to run the assembler. -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -78,7 +78,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
|
||||||
|
|
||||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -130,7 +130,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||||
|
|
||||||
# AM_CONDITIONAL -*- Autoconf -*-
|
# AM_CONDITIONAL -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -161,7 +161,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||||
Usually this means the macro was only invoked conditionally.]])
|
Usually this means the macro was only invoked conditionally.]])
|
||||||
fi])])
|
fi])])
|
||||||
|
|
||||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -352,13 +352,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
|
||||||
|
|
||||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
|
||||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||||
|
@ -366,49 +365,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||||
# Older Autoconf quotes --file arguments for eval, but not when files
|
# Older Autoconf quotes --file arguments for eval, but not when files
|
||||||
# are listed without --file. Let's play safe and only enable the eval
|
# are listed without --file. Let's play safe and only enable the eval
|
||||||
# if we detect the quoting.
|
# if we detect the quoting.
|
||||||
case $CONFIG_FILES in
|
# TODO: see whether this extra hack can be removed once we start
|
||||||
*\'*) eval set x "$CONFIG_FILES" ;;
|
# requiring Autoconf 2.70 or later.
|
||||||
*) set x $CONFIG_FILES ;;
|
AS_CASE([$CONFIG_FILES],
|
||||||
esac
|
[*\'*], [eval set x "$CONFIG_FILES"],
|
||||||
|
[*], [set x $CONFIG_FILES])
|
||||||
shift
|
shift
|
||||||
for mf
|
# Used to flag and report bootstrapping failures.
|
||||||
|
am_rc=0
|
||||||
|
for am_mf
|
||||||
do
|
do
|
||||||
# Strip MF so we end up with the name of the file.
|
# Strip MF so we end up with the name of the file.
|
||||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
|
||||||
# Check whether this is an Automake generated Makefile or not.
|
# Check whether this is an Automake generated Makefile which includes
|
||||||
# We used to match only the files named 'Makefile.in', but
|
# dependency-tracking related rules and includes.
|
||||||
# some people rename them; so instead we look at the file content.
|
# Grep'ing the whole file directly is not great: AIX grep has a line
|
||||||
# Grep'ing the first line is not enough: some people post-process
|
|
||||||
# each Makefile.in and add a new line on top of each file to say so.
|
|
||||||
# Grep'ing the whole file is not good either: AIX grep has a line
|
|
||||||
# limit of 2048, but all sed's we know have understand at least 4000.
|
# limit of 2048, but all sed's we know have understand at least 4000.
|
||||||
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
|
sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
|
||||||
dirpart=`AS_DIRNAME("$mf")`
|
|| continue
|
||||||
else
|
am_dirpart=`AS_DIRNAME(["$am_mf"])`
|
||||||
continue
|
am_filepart=`AS_BASENAME(["$am_mf"])`
|
||||||
|
AM_RUN_LOG([cd "$am_dirpart" \
|
||||||
|
&& sed -e '/# am--include-marker/d' "$am_filepart" \
|
||||||
|
| $MAKE -f - am--depfiles]) || am_rc=$?
|
||||||
|
done
|
||||||
|
if test $am_rc -ne 0; then
|
||||||
|
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
|
||||||
|
for automatic dependency tracking. Try re-running configure with the
|
||||||
|
'--disable-dependency-tracking' option to at least be able to build
|
||||||
|
the package (albeit without support for automatic dependency tracking).])
|
||||||
fi
|
fi
|
||||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
AS_UNSET([am_dirpart])
|
||||||
# from the Makefile without running 'make'.
|
AS_UNSET([am_filepart])
|
||||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
AS_UNSET([am_mf])
|
||||||
test -z "$DEPDIR" && continue
|
AS_UNSET([am_rc])
|
||||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
rm -f conftest-deps.mk
|
||||||
test -z "$am__include" && continue
|
|
||||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
|
||||||
# Find all dependency output files, they are included files with
|
|
||||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
|
||||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
|
||||||
# expansion.
|
|
||||||
for file in `sed -n "
|
|
||||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
|
||||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
|
|
||||||
# Make sure the directory exists.
|
|
||||||
test -f "$dirpart/$file" && continue
|
|
||||||
fdir=`AS_DIRNAME(["$file"])`
|
|
||||||
AS_MKDIR_P([$dirpart/$fdir])
|
|
||||||
# echo "creating $dirpart/$file"
|
|
||||||
echo '# dummy' > "$dirpart/$file"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||||
|
|
||||||
|
@ -417,18 +408,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||||
#
|
#
|
||||||
# This code is only required when automatic dependency tracking
|
# This code is only required when automatic dependency tracking is enabled.
|
||||||
# is enabled. FIXME. This creates each '.P' file that we will
|
# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
|
||||||
# need in order to bootstrap the dependency handling code.
|
# order to bootstrap the dependency handling code.
|
||||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||||
[AC_CONFIG_COMMANDS([depfiles],
|
[AC_CONFIG_COMMANDS([depfiles],
|
||||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
[AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
|
||||||
])
|
|
||||||
|
|
||||||
# Do all the work for Automake. -*- Autoconf -*-
|
# Do all the work for Automake. -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -515,8 +505,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
|
||||||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||||
# For better backward compatibility. To be removed once Automake 1.9.x
|
# For better backward compatibility. To be removed once Automake 1.9.x
|
||||||
# dies out for good. For more background, see:
|
# dies out for good. For more background, see:
|
||||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
|
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
|
||||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
||||||
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
|
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
|
||||||
# We need awk for the "check" target (and possibly the TAP driver). The
|
# We need awk for the "check" target (and possibly the TAP driver). The
|
||||||
# system "awk" is bad on some platforms.
|
# system "awk" is bad on some platforms.
|
||||||
|
@ -583,7 +573,7 @@ END
|
||||||
Aborting the configuration process, to ensure you take notice of the issue.
|
Aborting the configuration process, to ensure you take notice of the issue.
|
||||||
|
|
||||||
You can download and install GNU coreutils to get an 'rm' implementation
|
You can download and install GNU coreutils to get an 'rm' implementation
|
||||||
that behaves properly: <http://www.gnu.org/software/coreutils/>.
|
that behaves properly: <https://www.gnu.org/software/coreutils/>.
|
||||||
|
|
||||||
If you want to complete the configuration process using your problematic
|
If you want to complete the configuration process using your problematic
|
||||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||||
|
@ -625,7 +615,7 @@ for _am_header in $config_headers :; do
|
||||||
done
|
done
|
||||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||||
|
|
||||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -646,7 +636,7 @@ if test x"${install_sh+set}" != xset; then
|
||||||
fi
|
fi
|
||||||
AC_SUBST([install_sh])])
|
AC_SUBST([install_sh])])
|
||||||
|
|
||||||
# Copyright (C) 2003-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -668,7 +658,7 @@ AC_SUBST([am__leading_dot])])
|
||||||
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
||||||
# From Jim Meyering
|
# From Jim Meyering
|
||||||
|
|
||||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -703,7 +693,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||||
|
|
||||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -711,49 +701,42 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||||
|
|
||||||
# AM_MAKE_INCLUDE()
|
# AM_MAKE_INCLUDE()
|
||||||
# -----------------
|
# -----------------
|
||||||
# Check to see how make treats includes.
|
# Check whether make has an 'include' directive that can support all
|
||||||
|
# the idioms we need for our automatic dependency tracking code.
|
||||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||||
[am_make=${MAKE-make}
|
[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
|
||||||
cat > confinc << 'END'
|
cat > confinc.mk << 'END'
|
||||||
am__doit:
|
am__doit:
|
||||||
@echo this is the am__doit target
|
@echo this is the am__doit target >confinc.out
|
||||||
.PHONY: am__doit
|
.PHONY: am__doit
|
||||||
END
|
END
|
||||||
# If we don't find an include directive, just comment out the code.
|
|
||||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
|
||||||
am__include="#"
|
am__include="#"
|
||||||
am__quote=
|
am__quote=
|
||||||
_am_result=none
|
# BSD make does it like this.
|
||||||
# First try GNU make style include.
|
echo '.include "confinc.mk" # ignored' > confmf.BSD
|
||||||
echo "include confinc" > confmf
|
# Other make implementations (GNU, Solaris 10, AIX) do it like this.
|
||||||
# Ignore all kinds of additional output from 'make'.
|
echo 'include confinc.mk # ignored' > confmf.GNU
|
||||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
_am_result=no
|
||||||
*the\ am__doit\ target*)
|
for s in GNU BSD; do
|
||||||
am__include=include
|
AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
|
||||||
am__quote=
|
AS_CASE([$?:`cat confinc.out 2>/dev/null`],
|
||||||
_am_result=GNU
|
['0:this is the am__doit target'],
|
||||||
;;
|
[AS_CASE([$s],
|
||||||
esac
|
[BSD], [am__include='.include' am__quote='"'],
|
||||||
# Now try BSD make style include.
|
[am__include='include' am__quote=''])])
|
||||||
if test "$am__include" = "#"; then
|
if test "$am__include" != "#"; then
|
||||||
echo '.include "confinc"' > confmf
|
_am_result="yes ($s style)"
|
||||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
break
|
||||||
*the\ am__doit\ target*)
|
|
||||||
am__include=.include
|
|
||||||
am__quote="\""
|
|
||||||
_am_result=BSD
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
AC_SUBST([am__include])
|
done
|
||||||
AC_SUBST([am__quote])
|
rm -f confinc.* confmf.*
|
||||||
AC_MSG_RESULT([$_am_result])
|
AC_MSG_RESULT([${_am_result}])
|
||||||
rm -f confinc confmf
|
AC_SUBST([am__include])])
|
||||||
])
|
AC_SUBST([am__quote])])
|
||||||
|
|
||||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -792,7 +775,7 @@ fi
|
||||||
|
|
||||||
# Helper functions for option handling. -*- Autoconf -*-
|
# Helper functions for option handling. -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -821,7 +804,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
||||||
AC_DEFUN([_AM_IF_OPTION],
|
AC_DEFUN([_AM_IF_OPTION],
|
||||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||||
|
|
||||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -868,7 +851,7 @@ AC_LANG_POP([C])])
|
||||||
# For backward compatibility.
|
# For backward compatibility.
|
||||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||||
|
|
||||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -887,7 +870,7 @@ AC_DEFUN([AM_RUN_LOG],
|
||||||
|
|
||||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -968,7 +951,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||||
rm -f conftest.file
|
rm -f conftest.file
|
||||||
])
|
])
|
||||||
|
|
||||||
# Copyright (C) 2009-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -1028,7 +1011,7 @@ AC_SUBST([AM_BACKSLASH])dnl
|
||||||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -1056,7 +1039,7 @@ fi
|
||||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||||
|
|
||||||
# Copyright (C) 2006-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -1075,7 +1058,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||||
|
|
||||||
# Check how to create a tarball. -*- Autoconf -*-
|
# Check how to create a tarball. -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2004-2014 Free Software Foundation, Inc.
|
# Copyright (C) 2004-2018 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
|
|
||||||
/* arm_init.c - NEON optimised filter functions
|
/* arm_init.c - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||||
* Written by Mans Rullgard, 2011.
|
* Written by Mans Rullgard, 2011.
|
||||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
||||||
* called.
|
* called.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
/* filter_neon.S - NEON optimised filter functions
|
/* filter_neon.S - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
|
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
|
||||||
* Written by Mans Rullgard, 2011.
|
* Written by Mans Rullgard, 2011.
|
||||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
|
|
||||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||||
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
||||||
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
|
@ -19,7 +18,11 @@
|
||||||
/* This code requires -mfpu=neon on the command line: */
|
/* This code requires -mfpu=neon on the command line: */
|
||||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(_M_ARM64)
|
||||||
|
# include <arm64_neon.h>
|
||||||
|
#else
|
||||||
# include <arm_neon.h>
|
# include <arm_neon.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
||||||
* however this code will only work with appropriate alignment. arm/arm_init.c
|
* however this code will only work with appropriate alignment. arm/arm_init.c
|
||||||
|
@ -33,6 +36,11 @@
|
||||||
* 'type'. This is written this way just to hide the GCC strict aliasing
|
* 'type'. This is written this way just to hide the GCC strict aliasing
|
||||||
* warning; note that the code is safe because there never is an alias between
|
* warning; note that the code is safe because there never is an alias between
|
||||||
* the input and output pointers.
|
* the input and output pointers.
|
||||||
|
*
|
||||||
|
* When compiling with MSVC ARM64, the png_ldr macro can't be passed directly
|
||||||
|
* to vst4_lane_u32, because of an internal compiler error inside MSVC.
|
||||||
|
* To avoid this compiler bug, we use a temporary variable (vdest_val) to store
|
||||||
|
* the result of png_ldr.
|
||||||
*/
|
*/
|
||||||
#define png_ldr(type,pointer)\
|
#define png_ldr(type,pointer)\
|
||||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
||||||
|
@ -125,12 +133,15 @@ png_read_filter_row_sub4_neon(png_row_infop row_info, png_bytep row,
|
||||||
uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||||
uint8x8x4_t vrp = *vrpt;
|
uint8x8x4_t vrp = *vrpt;
|
||||||
uint32x2x4_t *temp_pointer;
|
uint32x2x4_t *temp_pointer;
|
||||||
|
uint32x2x4_t vdest_val;
|
||||||
|
|
||||||
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
||||||
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
||||||
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
||||||
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
|
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
|
||||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
|
||||||
|
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||||
|
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PNG_UNUSED(prev_row)
|
PNG_UNUSED(prev_row)
|
||||||
|
@ -223,6 +234,7 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
||||||
uint8x8x4_t *vrpt, *vppt;
|
uint8x8x4_t *vrpt, *vppt;
|
||||||
uint8x8x4_t vrp, vpp;
|
uint8x8x4_t vrp, vpp;
|
||||||
uint32x2x4_t *temp_pointer;
|
uint32x2x4_t *temp_pointer;
|
||||||
|
uint32x2x4_t vdest_val;
|
||||||
|
|
||||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||||
|
@ -240,7 +252,8 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
||||||
vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
|
vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
|
||||||
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
||||||
|
|
||||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||||
|
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,6 +372,7 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
||||||
uint8x8x4_t *vrpt, *vppt;
|
uint8x8x4_t *vrpt, *vppt;
|
||||||
uint8x8x4_t vrp, vpp;
|
uint8x8x4_t vrp, vpp;
|
||||||
uint32x2x4_t *temp_pointer;
|
uint32x2x4_t *temp_pointer;
|
||||||
|
uint32x2x4_t vdest_val;
|
||||||
|
|
||||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||||
|
@ -378,7 +392,8 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
||||||
|
|
||||||
vlast = vpp.val[3];
|
vlast = vpp.val[3];
|
||||||
|
|
||||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||||
|
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,149 @@
|
||||||
|
|
||||||
|
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2019 Cosmin Truta
|
||||||
|
* Copyright (c) 2017-2018 Arm Holdings. All rights reserved.
|
||||||
|
* Written by Richard Townsend <Richard.Townsend@arm.com>, February 2017.
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../pngpriv.h"
|
||||||
|
|
||||||
|
#if PNG_ARM_NEON_IMPLEMENTATION == 1
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(_M_ARM64)
|
||||||
|
# include <arm64_neon.h>
|
||||||
|
#else
|
||||||
|
# include <arm_neon.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Build an RGBA8 palette from the separate RGB and alpha palettes. */
|
||||||
|
void
|
||||||
|
png_riffle_palette_neon(png_structrp png_ptr)
|
||||||
|
{
|
||||||
|
png_const_colorp palette = png_ptr->palette;
|
||||||
|
png_bytep riffled_palette = png_ptr->riffled_palette;
|
||||||
|
png_const_bytep trans_alpha = png_ptr->trans_alpha;
|
||||||
|
int num_trans = png_ptr->num_trans;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
png_debug(1, "in png_riffle_palette_neon");
|
||||||
|
|
||||||
|
/* Initially black, opaque. */
|
||||||
|
uint8x16x4_t w = {{
|
||||||
|
vdupq_n_u8(0x00),
|
||||||
|
vdupq_n_u8(0x00),
|
||||||
|
vdupq_n_u8(0x00),
|
||||||
|
vdupq_n_u8(0xff),
|
||||||
|
}};
|
||||||
|
|
||||||
|
/* First, riffle the RGB colours into an RGBA8 palette.
|
||||||
|
* The alpha component is set to opaque for now.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < 256; i += 16)
|
||||||
|
{
|
||||||
|
uint8x16x3_t v = vld3q_u8((png_const_bytep)(palette + i));
|
||||||
|
w.val[0] = v.val[0];
|
||||||
|
w.val[1] = v.val[1];
|
||||||
|
w.val[2] = v.val[2];
|
||||||
|
vst4q_u8(riffled_palette + (i << 2), w);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fix up the missing transparency values. */
|
||||||
|
for (i = 0; i < num_trans; i++)
|
||||||
|
riffled_palette[(i << 2) + 3] = trans_alpha[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Expands a palettized row into RGBA8. */
|
||||||
|
int
|
||||||
|
png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
||||||
|
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
||||||
|
{
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
const png_uint_32 *riffled_palette =
|
||||||
|
(const png_uint_32 *)png_ptr->riffled_palette;
|
||||||
|
const png_int_32 pixels_per_chunk = 4;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
png_debug(1, "in png_do_expand_palette_rgba8_neon");
|
||||||
|
|
||||||
|
if (row_width < pixels_per_chunk)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* This function originally gets the last byte of the output row.
|
||||||
|
* The NEON part writes forward from a given position, so we have
|
||||||
|
* to seek this back by 4 pixels x 4 bytes.
|
||||||
|
*/
|
||||||
|
*ddp = *ddp - ((pixels_per_chunk * sizeof(png_uint_32)) - 1);
|
||||||
|
|
||||||
|
for (i = 0; i < row_width; i += pixels_per_chunk)
|
||||||
|
{
|
||||||
|
uint32x4_t cur;
|
||||||
|
png_bytep sp = *ssp - i, dp = *ddp - (i << 2);
|
||||||
|
cur = vld1q_dup_u32 (riffled_palette + *(sp - 3));
|
||||||
|
cur = vld1q_lane_u32(riffled_palette + *(sp - 2), cur, 1);
|
||||||
|
cur = vld1q_lane_u32(riffled_palette + *(sp - 1), cur, 2);
|
||||||
|
cur = vld1q_lane_u32(riffled_palette + *(sp - 0), cur, 3);
|
||||||
|
vst1q_u32((void *)dp, cur);
|
||||||
|
}
|
||||||
|
if (i != row_width)
|
||||||
|
{
|
||||||
|
/* Remove the amount that wasn't processed. */
|
||||||
|
i -= pixels_per_chunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Decrement output pointers. */
|
||||||
|
*ssp = *ssp - i;
|
||||||
|
*ddp = *ddp - (i << 2);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Expands a palettized row into RGB8. */
|
||||||
|
int
|
||||||
|
png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
|
||||||
|
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
||||||
|
{
|
||||||
|
png_uint_32 row_width = row_info->width;
|
||||||
|
png_const_bytep palette = (png_const_bytep)png_ptr->palette;
|
||||||
|
const png_uint_32 pixels_per_chunk = 8;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
png_debug(1, "in png_do_expand_palette_rgb8_neon");
|
||||||
|
|
||||||
|
if (row_width <= pixels_per_chunk)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Seeking this back by 8 pixels x 3 bytes. */
|
||||||
|
*ddp = *ddp - ((pixels_per_chunk * sizeof(png_color)) - 1);
|
||||||
|
|
||||||
|
for (i = 0; i < row_width; i += pixels_per_chunk)
|
||||||
|
{
|
||||||
|
uint8x8x3_t cur;
|
||||||
|
png_bytep sp = *ssp - i, dp = *ddp - ((i << 1) + i);
|
||||||
|
cur = vld3_dup_u8(palette + sizeof(png_color) * (*(sp - 7)));
|
||||||
|
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 6)), cur, 1);
|
||||||
|
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 5)), cur, 2);
|
||||||
|
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 4)), cur, 3);
|
||||||
|
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 3)), cur, 4);
|
||||||
|
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 2)), cur, 5);
|
||||||
|
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 1)), cur, 6);
|
||||||
|
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 0)), cur, 7);
|
||||||
|
vst3_u8((void *)dp, cur);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i != row_width)
|
||||||
|
{
|
||||||
|
/* Remove the amount that wasn't processed. */
|
||||||
|
i -= pixels_per_chunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Decrement output pointers. */
|
||||||
|
*ssp = *ssp - i;
|
||||||
|
*ddp = *ddp - ((i << 1) + i);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* PNG_ARM_NEON_IMPLEMENTATION */
|
|
@ -194,7 +194,7 @@ case "$mode" in
|
||||||
if test -d .git
|
if test -d .git
|
||||||
then
|
then
|
||||||
exec >&2
|
exec >&2
|
||||||
echo "ERROR: running autoreconf on an initialized sytem"
|
echo "ERROR: running autoreconf on an initialized system"
|
||||||
echo " This is not necessary; it is only necessary to remake the"
|
echo " This is not necessary; it is only necessary to remake the"
|
||||||
echo " autotools generated files if Makefile.am or configure.ac"
|
echo " autotools generated files if Makefile.am or configure.ac"
|
||||||
echo " change and make does the right thing with:"
|
echo " change and make does the right thing with:"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Wrapper for compilers which do not understand '-c -o'.
|
# Wrapper for compilers which do not understand '-c -o'.
|
||||||
|
|
||||||
scriptversion=2012-10-14.11; # UTC
|
scriptversion=2018-03-07.03; # UTC
|
||||||
|
|
||||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
|
@ -255,7 +255,8 @@ EOF
|
||||||
echo "compile $scriptversion"
|
echo "compile $scriptversion"
|
||||||
exit $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||||
|
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||||
func_cl_wrapper "$@" # Doesn't return...
|
func_cl_wrapper "$@" # Doesn't return...
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -339,9 +340,9 @@ exit $ret
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# mode: shell-script
|
# mode: shell-script
|
||||||
# sh-indentation: 2
|
# sh-indentation: 2
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||||
# time-stamp-start: "scriptversion="
|
# time-stamp-start: "scriptversion="
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
# time-stamp-time-zone: "UTC"
|
# time-stamp-time-zone: "UTC0"
|
||||||
# time-stamp-end: "; # UTC"
|
# time-stamp-end: "; # UTC"
|
||||||
# End:
|
# End:
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
#undef HAVE_MEMORY_H
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `memset' function. */
|
|
||||||
#undef HAVE_MEMSET
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `pow' function. */
|
/* Define to 1 if you have the `pow' function. */
|
||||||
#undef HAVE_POW
|
#undef HAVE_POW
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Configuration validation subroutine script.
|
# Configuration validation subroutine script.
|
||||||
# Copyright 1992-2014 Free Software Foundation, Inc.
|
# Copyright 1992-2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2014-12-03'
|
timestamp='2018-03-08'
|
||||||
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
|
@ -15,7 +15,7 @@ timestamp='2014-12-03'
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
# along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
|
@ -33,7 +33,7 @@ timestamp='2014-12-03'
|
||||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||||
|
|
||||||
# You can get the latest version of this script from:
|
# You can get the latest version of this script from:
|
||||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
|
||||||
|
|
||||||
# This file is supposed to be the same for all GNU packages
|
# This file is supposed to be the same for all GNU packages
|
||||||
# and recognize all the CPU types, system types and aliases
|
# and recognize all the CPU types, system types and aliases
|
||||||
|
@ -53,12 +53,11 @@ timestamp='2014-12-03'
|
||||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||||
|
|
||||||
usage="\
|
usage="\
|
||||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
|
||||||
$0 [OPTION] ALIAS
|
|
||||||
|
|
||||||
Canonicalize a configuration name.
|
Canonicalize a configuration name.
|
||||||
|
|
||||||
Operation modes:
|
Options:
|
||||||
-h, --help print this help, then exit
|
-h, --help print this help, then exit
|
||||||
-t, --time-stamp print date of last modification, then exit
|
-t, --time-stamp print date of last modification, then exit
|
||||||
-v, --version print version number, then exit
|
-v, --version print version number, then exit
|
||||||
|
@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||||
version="\
|
version="\
|
||||||
GNU config.sub ($timestamp)
|
GNU config.sub ($timestamp)
|
||||||
|
|
||||||
Copyright 1992-2014 Free Software Foundation, Inc.
|
Copyright 1992-2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
|
@ -95,7 +94,7 @@ while test $# -gt 0 ; do
|
||||||
|
|
||||||
*local*)
|
*local*)
|
||||||
# First pass through any local machine types.
|
# First pass through any local machine types.
|
||||||
echo $1
|
echo "$1"
|
||||||
exit ;;
|
exit ;;
|
||||||
|
|
||||||
* )
|
* )
|
||||||
|
@ -113,24 +112,24 @@ esac
|
||||||
|
|
||||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||||
case $maybe_os in
|
case $maybe_os in
|
||||||
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||||
knetbsd*-gnu* | netbsd*-gnu* | \
|
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
|
||||||
kopensolaris*-gnu* | \
|
kopensolaris*-gnu* | cloudabi*-eabi* | \
|
||||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||||
os=-$maybe_os
|
os=-$maybe_os
|
||||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||||
;;
|
;;
|
||||||
android-linux)
|
android-linux)
|
||||||
os=-linux-android
|
os=-linux-android
|
||||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
|
||||||
if [ $basic_machine != $1 ]
|
if [ "$basic_machine" != "$1" ]
|
||||||
then os=`echo $1 | sed 's/.*-/-/'`
|
then os=`echo "$1" | sed 's/.*-/-/'`
|
||||||
else os=; fi
|
else os=; fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -179,44 +178,44 @@ case $os in
|
||||||
;;
|
;;
|
||||||
-sco6)
|
-sco6)
|
||||||
os=-sco5v6
|
os=-sco5v6
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-sco5)
|
-sco5)
|
||||||
os=-sco3.2v5
|
os=-sco3.2v5
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-sco4)
|
-sco4)
|
||||||
os=-sco3.2v4
|
os=-sco3.2v4
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-sco3.2.[4-9]*)
|
-sco3.2.[4-9]*)
|
||||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-sco3.2v[4-9]*)
|
-sco3.2v[4-9]*)
|
||||||
# Don't forget version if it is 3.2v4 or newer.
|
# Don't forget version if it is 3.2v4 or newer.
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-sco5v6*)
|
-sco5v6*)
|
||||||
# Don't forget version if it is 3.2v4 or newer.
|
# Don't forget version if it is 3.2v4 or newer.
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-sco*)
|
-sco*)
|
||||||
os=-sco3.2v2
|
os=-sco3.2v2
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-udk*)
|
-udk*)
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-isc)
|
-isc)
|
||||||
os=-isc2.2
|
os=-isc2.2
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-clix*)
|
-clix*)
|
||||||
basic_machine=clipper-intergraph
|
basic_machine=clipper-intergraph
|
||||||
;;
|
;;
|
||||||
-isc*)
|
-isc*)
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
|
||||||
;;
|
;;
|
||||||
-lynx*178)
|
-lynx*178)
|
||||||
os=-lynxos178
|
os=-lynxos178
|
||||||
|
@ -228,10 +227,7 @@ case $os in
|
||||||
os=-lynxos
|
os=-lynxos
|
||||||
;;
|
;;
|
||||||
-ptx*)
|
-ptx*)
|
||||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
|
||||||
;;
|
|
||||||
-windowsnt*)
|
|
||||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
|
||||||
;;
|
;;
|
||||||
-psos*)
|
-psos*)
|
||||||
os=-psos
|
os=-psos
|
||||||
|
@ -255,15 +251,16 @@ case $basic_machine in
|
||||||
| arc | arceb \
|
| arc | arceb \
|
||||||
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||||
| avr | avr32 \
|
| avr | avr32 \
|
||||||
|
| ba \
|
||||||
| be32 | be64 \
|
| be32 | be64 \
|
||||||
| bfin \
|
| bfin \
|
||||||
| c4x | c8051 | clipper \
|
| c4x | c8051 | clipper \
|
||||||
| d10v | d30v | dlx | dsp16xx \
|
| d10v | d30v | dlx | dsp16xx \
|
||||||
| epiphany \
|
| e2k | epiphany \
|
||||||
| fido | fr30 | frv \
|
| fido | fr30 | frv | ft32 \
|
||||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||||
| hexagon \
|
| hexagon \
|
||||||
| i370 | i860 | i960 | ia64 \
|
| i370 | i860 | i960 | ia16 | ia64 \
|
||||||
| ip2k | iq2000 \
|
| ip2k | iq2000 \
|
||||||
| k1om \
|
| k1om \
|
||||||
| le32 | le64 \
|
| le32 | le64 \
|
||||||
|
@ -299,13 +296,14 @@ case $basic_machine in
|
||||||
| nios | nios2 | nios2eb | nios2el \
|
| nios | nios2 | nios2eb | nios2el \
|
||||||
| ns16k | ns32k \
|
| ns16k | ns32k \
|
||||||
| open8 | or1k | or1knd | or32 \
|
| open8 | or1k | or1knd | or32 \
|
||||||
| pdp10 | pdp11 | pj | pjl \
|
| pdp10 | pj | pjl \
|
||||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||||
|
| pru \
|
||||||
| pyramid \
|
| pyramid \
|
||||||
| riscv32 | riscv64 \
|
| riscv32 | riscv64 \
|
||||||
| rl78 | rx \
|
| rl78 | rx \
|
||||||
| score \
|
| score \
|
||||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||||
| sh64 | sh64le \
|
| sh64 | sh64le \
|
||||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||||
|
@ -314,7 +312,7 @@ case $basic_machine in
|
||||||
| ubicom32 \
|
| ubicom32 \
|
||||||
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||||
| visium \
|
| visium \
|
||||||
| we32k \
|
| wasm32 \
|
||||||
| x86 | xc16x | xstormy16 | xtensa \
|
| x86 | xc16x | xstormy16 | xtensa \
|
||||||
| z8k | z80)
|
| z8k | z80)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
|
@ -335,7 +333,7 @@ case $basic_machine in
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-none
|
os=-none
|
||||||
;;
|
;;
|
||||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
|
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
|
||||||
;;
|
;;
|
||||||
ms1)
|
ms1)
|
||||||
basic_machine=mt-unknown
|
basic_machine=mt-unknown
|
||||||
|
@ -364,7 +362,7 @@ case $basic_machine in
|
||||||
;;
|
;;
|
||||||
# Object if more than one company name word.
|
# Object if more than one company name word.
|
||||||
*-*-*)
|
*-*-*)
|
||||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
# Recognize the basic CPU types with company name.
|
# Recognize the basic CPU types with company name.
|
||||||
|
@ -376,17 +374,18 @@ case $basic_machine in
|
||||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||||
| avr-* | avr32-* \
|
| avr-* | avr32-* \
|
||||||
|
| ba-* \
|
||||||
| be32-* | be64-* \
|
| be32-* | be64-* \
|
||||||
| bfin-* | bs2000-* \
|
| bfin-* | bs2000-* \
|
||||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||||
| c8051-* | clipper-* | craynv-* | cydra-* \
|
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||||
| d10v-* | d30v-* | dlx-* \
|
| d10v-* | d30v-* | dlx-* \
|
||||||
| elxsi-* \
|
| e2k-* | elxsi-* \
|
||||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||||
| h8300-* | h8500-* \
|
| h8300-* | h8500-* \
|
||||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||||
| hexagon-* \
|
| hexagon-* \
|
||||||
| i*86-* | i860-* | i960-* | ia64-* \
|
| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
|
||||||
| ip2k-* | iq2000-* \
|
| ip2k-* | iq2000-* \
|
||||||
| k1om-* \
|
| k1om-* \
|
||||||
| le32-* | le64-* \
|
| le32-* | le64-* \
|
||||||
|
@ -427,13 +426,15 @@ case $basic_machine in
|
||||||
| orion-* \
|
| orion-* \
|
||||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||||
|
| pru-* \
|
||||||
| pyramid-* \
|
| pyramid-* \
|
||||||
|
| riscv32-* | riscv64-* \
|
||||||
| rl78-* | romp-* | rs6000-* | rx-* \
|
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||||
| sparclite-* \
|
| sparclite-* \
|
||||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
|
||||||
| tahoe-* \
|
| tahoe-* \
|
||||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||||
| tile*-* \
|
| tile*-* \
|
||||||
|
@ -442,6 +443,7 @@ case $basic_machine in
|
||||||
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||||
| vax-* \
|
| vax-* \
|
||||||
| visium-* \
|
| visium-* \
|
||||||
|
| wasm32-* \
|
||||||
| we32k-* \
|
| we32k-* \
|
||||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||||
| xstormy16-* | xtensa*-* \
|
| xstormy16-* | xtensa*-* \
|
||||||
|
@ -455,7 +457,7 @@ case $basic_machine in
|
||||||
# Recognize the various machine names and aliases which stand
|
# Recognize the various machine names and aliases which stand
|
||||||
# for a CPU type and a company and sometimes even an OS.
|
# for a CPU type and a company and sometimes even an OS.
|
||||||
386bsd)
|
386bsd)
|
||||||
basic_machine=i386-unknown
|
basic_machine=i386-pc
|
||||||
os=-bsd
|
os=-bsd
|
||||||
;;
|
;;
|
||||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||||
|
@ -489,7 +491,7 @@ case $basic_machine in
|
||||||
basic_machine=x86_64-pc
|
basic_machine=x86_64-pc
|
||||||
;;
|
;;
|
||||||
amd64-*)
|
amd64-*)
|
||||||
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
amdahl)
|
amdahl)
|
||||||
basic_machine=580-amdahl
|
basic_machine=580-amdahl
|
||||||
|
@ -518,6 +520,9 @@ case $basic_machine in
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
os=-aros
|
os=-aros
|
||||||
;;
|
;;
|
||||||
|
asmjs)
|
||||||
|
basic_machine=asmjs-unknown
|
||||||
|
;;
|
||||||
aux)
|
aux)
|
||||||
basic_machine=m68k-apple
|
basic_machine=m68k-apple
|
||||||
os=-aux
|
os=-aux
|
||||||
|
@ -531,7 +536,7 @@ case $basic_machine in
|
||||||
os=-linux
|
os=-linux
|
||||||
;;
|
;;
|
||||||
blackfin-*)
|
blackfin-*)
|
||||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
os=-linux
|
os=-linux
|
||||||
;;
|
;;
|
||||||
bluegene*)
|
bluegene*)
|
||||||
|
@ -539,13 +544,13 @@ case $basic_machine in
|
||||||
os=-cnk
|
os=-cnk
|
||||||
;;
|
;;
|
||||||
c54x-*)
|
c54x-*)
|
||||||
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
c55x-*)
|
c55x-*)
|
||||||
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
c6x-*)
|
c6x-*)
|
||||||
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
c90)
|
c90)
|
||||||
basic_machine=c90-cray
|
basic_machine=c90-cray
|
||||||
|
@ -634,10 +639,18 @@ case $basic_machine in
|
||||||
basic_machine=rs6000-bull
|
basic_machine=rs6000-bull
|
||||||
os=-bosx
|
os=-bosx
|
||||||
;;
|
;;
|
||||||
dpx2* | dpx2*-bull)
|
dpx2*)
|
||||||
basic_machine=m68k-bull
|
basic_machine=m68k-bull
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
|
e500v[12])
|
||||||
|
basic_machine=powerpc-unknown
|
||||||
|
os=$os"spe"
|
||||||
|
;;
|
||||||
|
e500v[12]-*)
|
||||||
|
basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
|
os=$os"spe"
|
||||||
|
;;
|
||||||
ebmon29k)
|
ebmon29k)
|
||||||
basic_machine=a29k-amd
|
basic_machine=a29k-amd
|
||||||
os=-ebmon
|
os=-ebmon
|
||||||
|
@ -727,9 +740,6 @@ case $basic_machine in
|
||||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||||
basic_machine=hppa1.0-hp
|
basic_machine=hppa1.0-hp
|
||||||
;;
|
;;
|
||||||
hppa-next)
|
|
||||||
os=-nextstep3
|
|
||||||
;;
|
|
||||||
hppaosf)
|
hppaosf)
|
||||||
basic_machine=hppa1.1-hp
|
basic_machine=hppa1.1-hp
|
||||||
os=-osf
|
os=-osf
|
||||||
|
@ -742,26 +752,26 @@ case $basic_machine in
|
||||||
basic_machine=i370-ibm
|
basic_machine=i370-ibm
|
||||||
;;
|
;;
|
||||||
i*86v32)
|
i*86v32)
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
|
||||||
os=-sysv32
|
os=-sysv32
|
||||||
;;
|
;;
|
||||||
i*86v4*)
|
i*86v4*)
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
i*86v)
|
i*86v)
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
i*86sol2)
|
i*86sol2)
|
||||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
|
||||||
os=-solaris2
|
os=-solaris2
|
||||||
;;
|
;;
|
||||||
i386mach)
|
i386mach)
|
||||||
basic_machine=i386-mach
|
basic_machine=i386-mach
|
||||||
os=-mach
|
os=-mach
|
||||||
;;
|
;;
|
||||||
i386-vsta | vsta)
|
vsta)
|
||||||
basic_machine=i386-unknown
|
basic_machine=i386-unknown
|
||||||
os=-vsta
|
os=-vsta
|
||||||
;;
|
;;
|
||||||
|
@ -780,19 +790,16 @@ case $basic_machine in
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
leon-*|leon[3-9]-*)
|
leon-*|leon[3-9]-*)
|
||||||
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
|
basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
|
||||||
;;
|
;;
|
||||||
m68knommu)
|
m68knommu)
|
||||||
basic_machine=m68k-unknown
|
basic_machine=m68k-unknown
|
||||||
os=-linux
|
os=-linux
|
||||||
;;
|
;;
|
||||||
m68knommu-*)
|
m68knommu-*)
|
||||||
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
os=-linux
|
os=-linux
|
||||||
;;
|
;;
|
||||||
m88k-omron*)
|
|
||||||
basic_machine=m88k-omron
|
|
||||||
;;
|
|
||||||
magnum | m3230)
|
magnum | m3230)
|
||||||
basic_machine=mips-mips
|
basic_machine=mips-mips
|
||||||
os=-sysv
|
os=-sysv
|
||||||
|
@ -824,10 +831,10 @@ case $basic_machine in
|
||||||
os=-mint
|
os=-mint
|
||||||
;;
|
;;
|
||||||
mips3*-*)
|
mips3*-*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
|
||||||
;;
|
;;
|
||||||
mips3*)
|
mips3*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
|
||||||
;;
|
;;
|
||||||
monitor)
|
monitor)
|
||||||
basic_machine=m68k-rom68k
|
basic_machine=m68k-rom68k
|
||||||
|
@ -846,7 +853,7 @@ case $basic_machine in
|
||||||
os=-msdos
|
os=-msdos
|
||||||
;;
|
;;
|
||||||
ms1-*)
|
ms1-*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
|
||||||
;;
|
;;
|
||||||
msys)
|
msys)
|
||||||
basic_machine=i686-pc
|
basic_machine=i686-pc
|
||||||
|
@ -933,6 +940,12 @@ case $basic_machine in
|
||||||
nsr-tandem)
|
nsr-tandem)
|
||||||
basic_machine=nsr-tandem
|
basic_machine=nsr-tandem
|
||||||
;;
|
;;
|
||||||
|
nsv-tandem)
|
||||||
|
basic_machine=nsv-tandem
|
||||||
|
;;
|
||||||
|
nsx-tandem)
|
||||||
|
basic_machine=nsx-tandem
|
||||||
|
;;
|
||||||
op50n-* | op60c-*)
|
op50n-* | op60c-*)
|
||||||
basic_machine=hppa1.1-oki
|
basic_machine=hppa1.1-oki
|
||||||
os=-proelf
|
os=-proelf
|
||||||
|
@ -965,7 +978,7 @@ case $basic_machine in
|
||||||
os=-linux
|
os=-linux
|
||||||
;;
|
;;
|
||||||
parisc-*)
|
parisc-*)
|
||||||
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
os=-linux
|
os=-linux
|
||||||
;;
|
;;
|
||||||
pbd)
|
pbd)
|
||||||
|
@ -981,7 +994,7 @@ case $basic_machine in
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
;;
|
;;
|
||||||
pc98-*)
|
pc98-*)
|
||||||
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
pentium | p5 | k5 | k6 | nexgen | viac3)
|
pentium | p5 | k5 | k6 | nexgen | viac3)
|
||||||
basic_machine=i586-pc
|
basic_machine=i586-pc
|
||||||
|
@ -996,16 +1009,16 @@ case $basic_machine in
|
||||||
basic_machine=i786-pc
|
basic_machine=i786-pc
|
||||||
;;
|
;;
|
||||||
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
|
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
|
||||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
|
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
|
||||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
pentium4-*)
|
pentium4-*)
|
||||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
pn)
|
pn)
|
||||||
basic_machine=pn-gould
|
basic_machine=pn-gould
|
||||||
|
@ -1015,23 +1028,23 @@ case $basic_machine in
|
||||||
ppc | ppcbe) basic_machine=powerpc-unknown
|
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||||
;;
|
;;
|
||||||
ppc-* | ppcbe-*)
|
ppc-* | ppcbe-*)
|
||||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
ppcle | powerpclittle)
|
||||||
basic_machine=powerpcle-unknown
|
basic_machine=powerpcle-unknown
|
||||||
;;
|
;;
|
||||||
ppcle-* | powerpclittle-*)
|
ppcle-* | powerpclittle-*)
|
||||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
ppc64) basic_machine=powerpc64-unknown
|
ppc64) basic_machine=powerpc64-unknown
|
||||||
;;
|
;;
|
||||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
ppc64le | powerpc64little)
|
||||||
basic_machine=powerpc64le-unknown
|
basic_machine=powerpc64le-unknown
|
||||||
;;
|
;;
|
||||||
ppc64le-* | powerpc64little-*)
|
ppc64le-* | powerpc64little-*)
|
||||||
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
ps2)
|
ps2)
|
||||||
basic_machine=i386-ibm
|
basic_machine=i386-ibm
|
||||||
|
@ -1085,17 +1098,10 @@ case $basic_machine in
|
||||||
sequent)
|
sequent)
|
||||||
basic_machine=i386-sequent
|
basic_machine=i386-sequent
|
||||||
;;
|
;;
|
||||||
sh)
|
|
||||||
basic_machine=sh-hitachi
|
|
||||||
os=-hms
|
|
||||||
;;
|
|
||||||
sh5el)
|
sh5el)
|
||||||
basic_machine=sh5le-unknown
|
basic_machine=sh5le-unknown
|
||||||
;;
|
;;
|
||||||
sh64)
|
simso-wrs)
|
||||||
basic_machine=sh64-unknown
|
|
||||||
;;
|
|
||||||
sparclite-wrs | simso-wrs)
|
|
||||||
basic_machine=sparclite-wrs
|
basic_machine=sparclite-wrs
|
||||||
os=-vxworks
|
os=-vxworks
|
||||||
;;
|
;;
|
||||||
|
@ -1114,7 +1120,7 @@ case $basic_machine in
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
strongarm-* | thumb-*)
|
strongarm-* | thumb-*)
|
||||||
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
sun2)
|
sun2)
|
||||||
basic_machine=m68000-sun
|
basic_machine=m68000-sun
|
||||||
|
@ -1236,6 +1242,9 @@ case $basic_machine in
|
||||||
basic_machine=hppa1.1-winbond
|
basic_machine=hppa1.1-winbond
|
||||||
os=-proelf
|
os=-proelf
|
||||||
;;
|
;;
|
||||||
|
x64)
|
||||||
|
basic_machine=x86_64-pc
|
||||||
|
;;
|
||||||
xbox)
|
xbox)
|
||||||
basic_machine=i686-pc
|
basic_machine=i686-pc
|
||||||
os=-mingw32
|
os=-mingw32
|
||||||
|
@ -1244,20 +1253,12 @@ case $basic_machine in
|
||||||
basic_machine=xps100-honeywell
|
basic_machine=xps100-honeywell
|
||||||
;;
|
;;
|
||||||
xscale-* | xscalee[bl]-*)
|
xscale-* | xscalee[bl]-*)
|
||||||
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
|
||||||
;;
|
;;
|
||||||
ymp)
|
ymp)
|
||||||
basic_machine=ymp-cray
|
basic_machine=ymp-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
z8k-*-coff)
|
|
||||||
basic_machine=z8k-unknown
|
|
||||||
os=-sim
|
|
||||||
;;
|
|
||||||
z80-*-coff)
|
|
||||||
basic_machine=z80-unknown
|
|
||||||
os=-sim
|
|
||||||
;;
|
|
||||||
none)
|
none)
|
||||||
basic_machine=none-none
|
basic_machine=none-none
|
||||||
os=-none
|
os=-none
|
||||||
|
@ -1286,10 +1287,6 @@ case $basic_machine in
|
||||||
vax)
|
vax)
|
||||||
basic_machine=vax-dec
|
basic_machine=vax-dec
|
||||||
;;
|
;;
|
||||||
pdp10)
|
|
||||||
# there are many clones, so DEC is not a safe bet
|
|
||||||
basic_machine=pdp10-unknown
|
|
||||||
;;
|
|
||||||
pdp11)
|
pdp11)
|
||||||
basic_machine=pdp11-dec
|
basic_machine=pdp11-dec
|
||||||
;;
|
;;
|
||||||
|
@ -1299,9 +1296,6 @@ case $basic_machine in
|
||||||
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
|
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||||
basic_machine=sh-unknown
|
basic_machine=sh-unknown
|
||||||
;;
|
;;
|
||||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
|
||||||
basic_machine=sparc-sun
|
|
||||||
;;
|
|
||||||
cydra)
|
cydra)
|
||||||
basic_machine=cydra-cydrome
|
basic_machine=cydra-cydrome
|
||||||
;;
|
;;
|
||||||
|
@ -1321,7 +1315,7 @@ case $basic_machine in
|
||||||
# Make sure to match an already-canonicalized machine name.
|
# Make sure to match an already-canonicalized machine name.
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -1329,10 +1323,10 @@ esac
|
||||||
# Here we canonicalize certain aliases for manufacturers.
|
# Here we canonicalize certain aliases for manufacturers.
|
||||||
case $basic_machine in
|
case $basic_machine in
|
||||||
*-digital*)
|
*-digital*)
|
||||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
|
||||||
;;
|
;;
|
||||||
*-commodore*)
|
*-commodore*)
|
||||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
|
@ -1343,8 +1337,8 @@ esac
|
||||||
if [ x"$os" != x"" ]
|
if [ x"$os" != x"" ]
|
||||||
then
|
then
|
||||||
case $os in
|
case $os in
|
||||||
# First match some system type aliases
|
# First match some system type aliases that might get confused
|
||||||
# that might get confused with valid system types.
|
# with valid system types.
|
||||||
# -solaris* is a basic system type, with this one exception.
|
# -solaris* is a basic system type, with this one exception.
|
||||||
-auroraux)
|
-auroraux)
|
||||||
os=-auroraux
|
os=-auroraux
|
||||||
|
@ -1355,45 +1349,48 @@ case $os in
|
||||||
-solaris)
|
-solaris)
|
||||||
os=-solaris2
|
os=-solaris2
|
||||||
;;
|
;;
|
||||||
-svr4*)
|
|
||||||
os=-sysv4
|
|
||||||
;;
|
|
||||||
-unixware*)
|
-unixware*)
|
||||||
os=-sysv4.2uw
|
os=-sysv4.2uw
|
||||||
;;
|
;;
|
||||||
-gnu/linux*)
|
-gnu/linux*)
|
||||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||||
;;
|
;;
|
||||||
# First accept the basic system types.
|
# es1800 is here to avoid being matched by es* (a different OS)
|
||||||
|
-es1800*)
|
||||||
|
os=-ose
|
||||||
|
;;
|
||||||
|
# Now accept the basic system types.
|
||||||
# The portable systems comes first.
|
# The portable systems comes first.
|
||||||
# Each alternative MUST END IN A *, to match a version number.
|
# Each alternative MUST end in a * to match a version number.
|
||||||
# -sysv* is not here because it comes later, after sysvr4.
|
# -sysv* is not here because it comes later, after sysvr4.
|
||||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||||
| -sym* | -kopensolaris* | -plan9* \
|
| -sym* | -kopensolaris* | -plan9* \
|
||||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||||
| -aos* | -aros* \
|
| -aos* | -aros* | -cloudabi* | -sortix* \
|
||||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
| -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||||
| -bitrig* | -openbsd* | -solidbsd* \
|
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
|
||||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \
|
||||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
| -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
|
||||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||||
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
||||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
|
||||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
| -morphos* | -superux* | -rtmk* | -windiss* \
|
||||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
|
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
|
||||||
|
| -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
|
||||||
|
| -midnightbsd*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
-qnx*)
|
-qnx*)
|
||||||
|
@ -1410,12 +1407,12 @@ case $os in
|
||||||
-nto*)
|
-nto*)
|
||||||
os=`echo $os | sed -e 's|nto|nto-qnx|'`
|
os=`echo $os | sed -e 's|nto|nto-qnx|'`
|
||||||
;;
|
;;
|
||||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
-sim | -xray | -os68k* | -v88r* \
|
||||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
|
| -windows* | -osx | -abug | -netware* | -os9* \
|
||||||
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
|
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
|
||||||
;;
|
;;
|
||||||
-mac*)
|
-mac*)
|
||||||
os=`echo $os | sed -e 's|mac|macos|'`
|
os=`echo "$os" | sed -e 's|mac|macos|'`
|
||||||
;;
|
;;
|
||||||
-linux-dietlibc)
|
-linux-dietlibc)
|
||||||
os=-linux-dietlibc
|
os=-linux-dietlibc
|
||||||
|
@ -1424,10 +1421,10 @@ case $os in
|
||||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||||
;;
|
;;
|
||||||
-sunos5*)
|
-sunos5*)
|
||||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
|
||||||
;;
|
;;
|
||||||
-sunos6*)
|
-sunos6*)
|
||||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
|
||||||
;;
|
;;
|
||||||
-opened*)
|
-opened*)
|
||||||
os=-openedition
|
os=-openedition
|
||||||
|
@ -1438,12 +1435,6 @@ case $os in
|
||||||
-wince*)
|
-wince*)
|
||||||
os=-wince
|
os=-wince
|
||||||
;;
|
;;
|
||||||
-osfrose*)
|
|
||||||
os=-osfrose
|
|
||||||
;;
|
|
||||||
-osf*)
|
|
||||||
os=-osf
|
|
||||||
;;
|
|
||||||
-utek*)
|
-utek*)
|
||||||
os=-bsd
|
os=-bsd
|
||||||
;;
|
;;
|
||||||
|
@ -1490,7 +1481,7 @@ case $os in
|
||||||
-oss*)
|
-oss*)
|
||||||
os=-sysv3
|
os=-sysv3
|
||||||
;;
|
;;
|
||||||
-svr4)
|
-svr4*)
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
-svr3)
|
-svr3)
|
||||||
|
@ -1505,32 +1496,38 @@ case $os in
|
||||||
-ose*)
|
-ose*)
|
||||||
os=-ose
|
os=-ose
|
||||||
;;
|
;;
|
||||||
-es1800*)
|
|
||||||
os=-ose
|
|
||||||
;;
|
|
||||||
-xenix)
|
|
||||||
os=-xenix
|
|
||||||
;;
|
|
||||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||||
os=-mint
|
os=-mint
|
||||||
;;
|
;;
|
||||||
-aros*)
|
|
||||||
os=-aros
|
|
||||||
;;
|
|
||||||
-zvmoe)
|
-zvmoe)
|
||||||
os=-zvmoe
|
os=-zvmoe
|
||||||
;;
|
;;
|
||||||
-dicos*)
|
-dicos*)
|
||||||
os=-dicos
|
os=-dicos
|
||||||
;;
|
;;
|
||||||
|
-pikeos*)
|
||||||
|
# Until real need of OS specific support for
|
||||||
|
# particular features comes up, bare metal
|
||||||
|
# configurations are quite functional.
|
||||||
|
case $basic_machine in
|
||||||
|
arm*)
|
||||||
|
os=-eabi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
-nacl*)
|
-nacl*)
|
||||||
;;
|
;;
|
||||||
|
-ios)
|
||||||
|
;;
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Get rid of the `-' at the beginning of $os.
|
# Get rid of the `-' at the beginning of $os.
|
||||||
os=`echo $os | sed 's/[^-]*-//'`
|
os=`echo $os | sed 's/[^-]*-//'`
|
||||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -1620,12 +1617,12 @@ case $basic_machine in
|
||||||
sparc-* | *-sun)
|
sparc-* | *-sun)
|
||||||
os=-sunos4.1.1
|
os=-sunos4.1.1
|
||||||
;;
|
;;
|
||||||
|
pru-*)
|
||||||
|
os=-elf
|
||||||
|
;;
|
||||||
*-be)
|
*-be)
|
||||||
os=-beos
|
os=-beos
|
||||||
;;
|
;;
|
||||||
*-haiku)
|
|
||||||
os=-haiku
|
|
||||||
;;
|
|
||||||
*-ibm)
|
*-ibm)
|
||||||
os=-aix
|
os=-aix
|
||||||
;;
|
;;
|
||||||
|
@ -1680,9 +1677,6 @@ case $basic_machine in
|
||||||
i370-*)
|
i370-*)
|
||||||
os=-mvs
|
os=-mvs
|
||||||
;;
|
;;
|
||||||
*-next)
|
|
||||||
os=-nextstep3
|
|
||||||
;;
|
|
||||||
*-gould)
|
*-gould)
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
@ -1792,15 +1786,15 @@ case $basic_machine in
|
||||||
vendor=stratus
|
vendor=stratus
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo $basic_machine$os
|
echo "$basic_machine$os"
|
||||||
exit
|
exit
|
||||||
|
|
||||||
# Local variables:
|
# Local variables:
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||||
# time-stamp-start: "timestamp='"
|
# time-stamp-start: "timestamp='"
|
||||||
# time-stamp-format: "%:y-%02m-%02d"
|
# time-stamp-format: "%:y-%02m-%02d"
|
||||||
# time-stamp-end: "'"
|
# time-stamp-end: "'"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for libpng 1.6.34.
|
# Generated by GNU Autoconf 2.69 for libpng 1.6.37.
|
||||||
#
|
#
|
||||||
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
|
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
|
||||||
#
|
#
|
||||||
|
@ -590,8 +590,8 @@ MAKEFLAGS=
|
||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='libpng'
|
PACKAGE_NAME='libpng'
|
||||||
PACKAGE_TARNAME='libpng'
|
PACKAGE_TARNAME='libpng'
|
||||||
PACKAGE_VERSION='1.6.34'
|
PACKAGE_VERSION='1.6.37'
|
||||||
PACKAGE_STRING='libpng 1.6.34'
|
PACKAGE_STRING='libpng 1.6.37'
|
||||||
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
|
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
|
||||||
PACKAGE_URL=''
|
PACKAGE_URL=''
|
||||||
|
|
||||||
|
@ -713,7 +713,6 @@ am__nodep
|
||||||
AMDEPBACKSLASH
|
AMDEPBACKSLASH
|
||||||
AMDEP_FALSE
|
AMDEP_FALSE
|
||||||
AMDEP_TRUE
|
AMDEP_TRUE
|
||||||
am__quote
|
|
||||||
am__include
|
am__include
|
||||||
DEPDIR
|
DEPDIR
|
||||||
OBJEXT
|
OBJEXT
|
||||||
|
@ -790,7 +789,8 @@ PACKAGE_VERSION
|
||||||
PACKAGE_TARNAME
|
PACKAGE_TARNAME
|
||||||
PACKAGE_NAME
|
PACKAGE_NAME
|
||||||
PATH_SEPARATOR
|
PATH_SEPARATOR
|
||||||
SHELL'
|
SHELL
|
||||||
|
am__quote'
|
||||||
ac_subst_files=''
|
ac_subst_files=''
|
||||||
ac_user_opts='
|
ac_user_opts='
|
||||||
enable_option_checking
|
enable_option_checking
|
||||||
|
@ -1372,7 +1372,7 @@ if test "$ac_init_help" = "long"; then
|
||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures libpng 1.6.34 to adapt to many kinds of systems.
|
\`configure' configures libpng 1.6.37 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
|
@ -1442,7 +1442,7 @@ fi
|
||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of libpng 1.6.34:";;
|
short | recursive ) echo "Configuration of libpng 1.6.37:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
|
@ -1622,7 +1622,7 @@ fi
|
||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
libpng configure 1.6.34
|
libpng configure 1.6.37
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
|
@ -1954,7 +1954,7 @@ cat >config.log <<_ACEOF
|
||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by libpng $as_me 1.6.34, which was
|
It was created by libpng $as_me 1.6.37, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
|
@ -2310,7 +2310,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
# dist-xz requires automake 1.11 or later
|
# dist-xz requires automake 1.11 or later
|
||||||
# 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
|
# 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
|
||||||
# 1.13 is required for parallel tests
|
# 1.13 is required for parallel tests
|
||||||
am__api_version='1.15'
|
am__api_version='1.16'
|
||||||
|
|
||||||
ac_aux_dir=
|
ac_aux_dir=
|
||||||
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
|
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
|
||||||
|
@ -2825,7 +2825,7 @@ fi
|
||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='libpng'
|
PACKAGE='libpng'
|
||||||
VERSION='1.6.34'
|
VERSION='1.6.37'
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
@ -2855,8 +2855,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
|
||||||
|
|
||||||
# For better backward compatibility. To be removed once Automake 1.9.x
|
# For better backward compatibility. To be removed once Automake 1.9.x
|
||||||
# dies out for good. For more background, see:
|
# dies out for good. For more background, see:
|
||||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
|
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
|
||||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
||||||
mkdir_p='$(MKDIR_P)'
|
mkdir_p='$(MKDIR_P)'
|
||||||
|
|
||||||
# We need awk for the "check" target (and possibly the TAP driver). The
|
# We need awk for the "check" target (and possibly the TAP driver). The
|
||||||
|
@ -2907,7 +2907,7 @@ END
|
||||||
Aborting the configuration process, to ensure you take notice of the issue.
|
Aborting the configuration process, to ensure you take notice of the issue.
|
||||||
|
|
||||||
You can download and install GNU coreutils to get an 'rm' implementation
|
You can download and install GNU coreutils to get an 'rm' implementation
|
||||||
that behaves properly: <http://www.gnu.org/software/coreutils/>.
|
that behaves properly: <https://www.gnu.org/software/coreutils/>.
|
||||||
|
|
||||||
If you want to complete the configuration process using your problematic
|
If you want to complete the configuration process using your problematic
|
||||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||||
|
@ -2946,10 +2946,10 @@ fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PNGLIB_VERSION=1.6.34
|
PNGLIB_VERSION=1.6.37
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=6
|
PNGLIB_MINOR=6
|
||||||
PNGLIB_RELEASE=34
|
PNGLIB_RELEASE=37
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3814,45 +3814,45 @@ DEPDIR="${am__leading_dot}deps"
|
||||||
|
|
||||||
ac_config_commands="$ac_config_commands depfiles"
|
ac_config_commands="$ac_config_commands depfiles"
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
|
||||||
am_make=${MAKE-make}
|
$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
|
||||||
cat > confinc << 'END'
|
cat > confinc.mk << 'END'
|
||||||
am__doit:
|
am__doit:
|
||||||
@echo this is the am__doit target
|
@echo this is the am__doit target >confinc.out
|
||||||
.PHONY: am__doit
|
.PHONY: am__doit
|
||||||
END
|
END
|
||||||
# If we don't find an include directive, just comment out the code.
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
|
|
||||||
$as_echo_n "checking for style of include used by $am_make... " >&6; }
|
|
||||||
am__include="#"
|
am__include="#"
|
||||||
am__quote=
|
am__quote=
|
||||||
_am_result=none
|
# BSD make does it like this.
|
||||||
# First try GNU make style include.
|
echo '.include "confinc.mk" # ignored' > confmf.BSD
|
||||||
echo "include confinc" > confmf
|
# Other make implementations (GNU, Solaris 10, AIX) do it like this.
|
||||||
# Ignore all kinds of additional output from 'make'.
|
echo 'include confinc.mk # ignored' > confmf.GNU
|
||||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
_am_result=no
|
||||||
*the\ am__doit\ target*)
|
for s in GNU BSD; do
|
||||||
am__include=include
|
{ echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
|
||||||
am__quote=
|
(${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
|
||||||
_am_result=GNU
|
ac_status=$?
|
||||||
;;
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
esac
|
(exit $ac_status); }
|
||||||
# Now try BSD make style include.
|
case $?:`cat confinc.out 2>/dev/null` in #(
|
||||||
if test "$am__include" = "#"; then
|
'0:this is the am__doit target') :
|
||||||
echo '.include "confinc"' > confmf
|
case $s in #(
|
||||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
BSD) :
|
||||||
*the\ am__doit\ target*)
|
am__include='.include' am__quote='"' ;; #(
|
||||||
am__include=.include
|
*) :
|
||||||
am__quote="\""
|
am__include='include' am__quote='' ;;
|
||||||
_am_result=BSD
|
esac ;; #(
|
||||||
|
*) :
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
if test "$am__include" != "#"; then
|
||||||
|
_am_result="yes ($s style)"
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
rm -f confinc.* confmf.*
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
|
||||||
$as_echo "$_am_result" >&6; }
|
$as_echo "${_am_result}" >&6; }
|
||||||
rm -f confinc confmf
|
|
||||||
|
|
||||||
# Check whether --enable-dependency-tracking was given.
|
# Check whether --enable-dependency-tracking was given.
|
||||||
if test "${enable_dependency_tracking+set}" = set; then :
|
if test "${enable_dependency_tracking+set}" = set; then :
|
||||||
|
@ -13066,19 +13066,6 @@ fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for ac_func in memset
|
|
||||||
do :
|
|
||||||
ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset"
|
|
||||||
if test "x$ac_cv_func_memset" = xyes; then :
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define HAVE_MEMSET 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
else
|
|
||||||
as_fn_error $? "memset not found in libc" "$LINENO" 5
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
for ac_func in pow
|
for ac_func in pow
|
||||||
do :
|
do :
|
||||||
ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow"
|
ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow"
|
||||||
|
@ -14367,7 +14354,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by libpng $as_me 1.6.34, which was
|
This file was extended by libpng $as_me 1.6.37, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
|
@ -14433,7 +14420,7 @@ _ACEOF
|
||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
libpng config.status 1.6.34
|
libpng config.status 1.6.37
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
@ -14552,7 +14539,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
#
|
#
|
||||||
# INIT-COMMANDS
|
# INIT-COMMANDS
|
||||||
#
|
#
|
||||||
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
|
AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
|
||||||
|
|
||||||
|
|
||||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||||
|
@ -15452,29 +15439,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
|
||||||
# Older Autoconf quotes --file arguments for eval, but not when files
|
# Older Autoconf quotes --file arguments for eval, but not when files
|
||||||
# are listed without --file. Let's play safe and only enable the eval
|
# are listed without --file. Let's play safe and only enable the eval
|
||||||
# if we detect the quoting.
|
# if we detect the quoting.
|
||||||
case $CONFIG_FILES in
|
# TODO: see whether this extra hack can be removed once we start
|
||||||
*\'*) eval set x "$CONFIG_FILES" ;;
|
# requiring Autoconf 2.70 or later.
|
||||||
*) set x $CONFIG_FILES ;;
|
case $CONFIG_FILES in #(
|
||||||
|
*\'*) :
|
||||||
|
eval set x "$CONFIG_FILES" ;; #(
|
||||||
|
*) :
|
||||||
|
set x $CONFIG_FILES ;; #(
|
||||||
|
*) :
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
for mf
|
# Used to flag and report bootstrapping failures.
|
||||||
|
am_rc=0
|
||||||
|
for am_mf
|
||||||
do
|
do
|
||||||
# Strip MF so we end up with the name of the file.
|
# Strip MF so we end up with the name of the file.
|
||||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
|
||||||
# Check whether this is an Automake generated Makefile or not.
|
# Check whether this is an Automake generated Makefile which includes
|
||||||
# We used to match only the files named 'Makefile.in', but
|
# dependency-tracking related rules and includes.
|
||||||
# some people rename them; so instead we look at the file content.
|
# Grep'ing the whole file directly is not great: AIX grep has a line
|
||||||
# Grep'ing the first line is not enough: some people post-process
|
|
||||||
# each Makefile.in and add a new line on top of each file to say so.
|
|
||||||
# Grep'ing the whole file is not good either: AIX grep has a line
|
|
||||||
# limit of 2048, but all sed's we know have understand at least 4000.
|
# limit of 2048, but all sed's we know have understand at least 4000.
|
||||||
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
|
sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
|
||||||
dirpart=`$as_dirname -- "$mf" ||
|
|| continue
|
||||||
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
am_dirpart=`$as_dirname -- "$am_mf" ||
|
||||||
X"$mf" : 'X\(//\)[^/]' \| \
|
$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||||
X"$mf" : 'X\(//\)$' \| \
|
X"$am_mf" : 'X\(//\)[^/]' \| \
|
||||||
X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
|
X"$am_mf" : 'X\(//\)$' \| \
|
||||||
$as_echo X"$mf" |
|
X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
|
||||||
|
$as_echo X"$am_mf" |
|
||||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||||
s//\1/
|
s//\1/
|
||||||
q
|
q
|
||||||
|
@ -15492,53 +15485,48 @@ $as_echo X"$mf" |
|
||||||
q
|
q
|
||||||
}
|
}
|
||||||
s/.*/./; q'`
|
s/.*/./; q'`
|
||||||
else
|
am_filepart=`$as_basename -- "$am_mf" ||
|
||||||
continue
|
$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
|
||||||
|
X"$am_mf" : 'X\(//\)$' \| \
|
||||||
|
X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
|
||||||
|
$as_echo X/"$am_mf" |
|
||||||
|
sed '/^.*\/\([^/][^/]*\)\/*$/{
|
||||||
|
s//\1/
|
||||||
|
q
|
||||||
|
}
|
||||||
|
/^X\/\(\/\/\)$/{
|
||||||
|
s//\1/
|
||||||
|
q
|
||||||
|
}
|
||||||
|
/^X\/\(\/\).*/{
|
||||||
|
s//\1/
|
||||||
|
q
|
||||||
|
}
|
||||||
|
s/.*/./; q'`
|
||||||
|
{ echo "$as_me:$LINENO: cd "$am_dirpart" \
|
||||||
|
&& sed -e '/# am--include-marker/d' "$am_filepart" \
|
||||||
|
| $MAKE -f - am--depfiles" >&5
|
||||||
|
(cd "$am_dirpart" \
|
||||||
|
&& sed -e '/# am--include-marker/d' "$am_filepart" \
|
||||||
|
| $MAKE -f - am--depfiles) >&5 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } || am_rc=$?
|
||||||
|
done
|
||||||
|
if test $am_rc -ne 0; then
|
||||||
|
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||||
|
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||||
|
as_fn_error $? "Something went wrong bootstrapping makefile fragments
|
||||||
|
for automatic dependency tracking. Try re-running configure with the
|
||||||
|
'--disable-dependency-tracking' option to at least be able to build
|
||||||
|
the package (albeit without support for automatic dependency tracking).
|
||||||
|
See \`config.log' for more details" "$LINENO" 5; }
|
||||||
fi
|
fi
|
||||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
{ am_dirpart=; unset am_dirpart;}
|
||||||
# from the Makefile without running 'make'.
|
{ am_filepart=; unset am_filepart;}
|
||||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
{ am_mf=; unset am_mf;}
|
||||||
test -z "$DEPDIR" && continue
|
{ am_rc=; unset am_rc;}
|
||||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
rm -f conftest-deps.mk
|
||||||
test -z "$am__include" && continue
|
|
||||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
|
||||||
# Find all dependency output files, they are included files with
|
|
||||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
|
||||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
|
||||||
# expansion.
|
|
||||||
for file in `sed -n "
|
|
||||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
|
||||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
|
|
||||||
# Make sure the directory exists.
|
|
||||||
test -f "$dirpart/$file" && continue
|
|
||||||
fdir=`$as_dirname -- "$file" ||
|
|
||||||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
|
||||||
X"$file" : 'X\(//\)[^/]' \| \
|
|
||||||
X"$file" : 'X\(//\)$' \| \
|
|
||||||
X"$file" : 'X\(/\)' \| . 2>/dev/null ||
|
|
||||||
$as_echo X"$file" |
|
|
||||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
/^X\(\/\/\)[^/].*/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
/^X\(\/\/\)$/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
/^X\(\/\).*/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
s/.*/./; q'`
|
|
||||||
as_dir=$dirpart/$fdir; as_fn_mkdir_p
|
|
||||||
# echo "creating $dirpart/$file"
|
|
||||||
echo '# dummy' > "$dirpart/$file"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
"libtool":C)
|
"libtool":C)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# configure.ac
|
# configure.ac
|
||||||
|
|
||||||
|
# Copyright (c) 2018 Cosmin Truta
|
||||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
# Last changed in libpng 1.6.25 [September 1, 2016]
|
|
||||||
|
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
@ -25,7 +25,7 @@ AC_PREREQ([2.68])
|
||||||
|
|
||||||
dnl Version number stuff here:
|
dnl Version number stuff here:
|
||||||
|
|
||||||
AC_INIT([libpng],[1.6.34],[png-mng-implement@lists.sourceforge.net])
|
AC_INIT([libpng],[1.6.37],[png-mng-implement@lists.sourceforge.net])
|
||||||
AC_CONFIG_MACRO_DIR([scripts])
|
AC_CONFIG_MACRO_DIR([scripts])
|
||||||
|
|
||||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||||
|
@ -46,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
|
||||||
dnl AM_PREREQ([1.11.2])
|
dnl AM_PREREQ([1.11.2])
|
||||||
dnl stop configure from automagically running automake
|
dnl stop configure from automagically running automake
|
||||||
|
|
||||||
PNGLIB_VERSION=1.6.34
|
PNGLIB_VERSION=1.6.37
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=6
|
PNGLIB_MINOR=6
|
||||||
PNGLIB_RELEASE=34
|
PNGLIB_RELEASE=37
|
||||||
|
|
||||||
dnl End of version number stuff
|
dnl End of version number stuff
|
||||||
|
|
||||||
|
@ -144,7 +144,6 @@ AC_C_RESTRICT
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_STRTOD
|
AC_FUNC_STRTOD
|
||||||
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
|
|
||||||
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
|
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
|
||||||
|
|
||||||
# Some later POSIX 1003.1 functions are required for test programs, failure here
|
# Some later POSIX 1003.1 functions are required for test programs, failure here
|
||||||
|
|
|
@ -33,7 +33,7 @@ option WRITE_16BIT on
|
||||||
option WRITE_FILTER on
|
option WRITE_FILTER on
|
||||||
|
|
||||||
# pngcp needs this to preserve unknown chunks, switching all these on means that
|
# pngcp needs this to preserve unknown chunks, switching all these on means that
|
||||||
# pngcp can work without explicit known chunk reading suppport
|
# pngcp can work without explicit known chunk reading support
|
||||||
option UNKNOWN_CHUNKS on
|
option UNKNOWN_CHUNKS on
|
||||||
option SET_UNKNOWN_CHUNKS on
|
option SET_UNKNOWN_CHUNKS on
|
||||||
option HANDLE_AS_UNKNOWN on
|
option HANDLE_AS_UNKNOWN on
|
||||||
|
@ -52,6 +52,6 @@ option TEXT on
|
||||||
option USER_LIMITS on
|
option USER_LIMITS on
|
||||||
option SET_USER_LIMITS on
|
option SET_USER_LIMITS on
|
||||||
|
|
||||||
# these are are just required for specific customizations
|
# these are just required for specific customizations
|
||||||
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
|
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
|
||||||
option WRITE_CUSTOMIZE_COMPRESSION on
|
option WRITE_CUSTOMIZE_COMPRESSION on
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* without processing the image. Notice that some header information may occur
|
* without processing the image. Notice that some header information may occur
|
||||||
* after the image data. Textual data and comments are an example; the approach
|
* after the image data. Textual data and comments are an example; the approach
|
||||||
* in this file won't work reliably for such data because it only looks for the
|
* in this file won't work reliably for such data because it only looks for the
|
||||||
* information in the section of the file that preceeds the image data.
|
* information in the section of the file that precedes the image data.
|
||||||
*
|
*
|
||||||
* Compile and link against libpng and zlib, plus anything else required on the
|
* Compile and link against libpng and zlib, plus anything else required on the
|
||||||
* system you use.
|
* system you use.
|
||||||
|
|
|
@ -42,7 +42,7 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
|
||||||
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
|
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
|
||||||
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
|
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
|
||||||
|
|
||||||
row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi);
|
row = (png_const_bytep)(((const png_byte (*)[8])row) + bit_offset_hi);
|
||||||
row += bit_offset_lo >> 3;
|
row += bit_offset_lo >> 3;
|
||||||
bit_offset_lo &= 0x07;
|
bit_offset_lo &= 0x07;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ static void
|
||||||
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||||
png_uint_32 x)
|
png_uint_32 x)
|
||||||
{
|
{
|
||||||
PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
||||||
|
|
||||||
switch (png_get_color_type(png_ptr, info_ptr))
|
switch (png_get_color_type(png_ptr, info_ptr))
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||||
*/
|
*/
|
||||||
case PNG_COLOR_TYPE_PALETTE:
|
case PNG_COLOR_TYPE_PALETTE:
|
||||||
{
|
{
|
||||||
PNG_CONST int index = component(row, x, 0, bit_depth, 1);
|
int index = component(row, x, 0, bit_depth, 1);
|
||||||
png_colorp palette = NULL;
|
png_colorp palette = NULL;
|
||||||
int num_palette = 0;
|
int num_palette = 0;
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
||||||
/* These byte strings were copied from png.h. If a future version
|
/* These byte strings were copied from png.h. If a future version
|
||||||
* of readpng2.c recognizes more chunks, add them to this list.
|
* of readpng2.c recognizes more chunks, add them to this list.
|
||||||
*/
|
*/
|
||||||
static PNG_CONST png_byte chunks_to_process[] = {
|
static const png_byte chunks_to_process[] = {
|
||||||
98, 75, 71, 68, '\0', /* bKGD */
|
98, 75, 71, 68, '\0', /* bKGD */
|
||||||
103, 65, 77, 65, '\0', /* gAMA */
|
103, 65, 77, 65, '\0', /* gAMA */
|
||||||
115, 82, 71, 66, '\0', /* sRGB */
|
115, 82, 71, 66, '\0', /* sRGB */
|
||||||
|
|
|
@ -661,7 +661,7 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const png_uint_32 luma = colors[1];
|
png_uint_32 luma = colors[1];
|
||||||
png_uint_32 x;
|
png_uint_32 x;
|
||||||
|
|
||||||
for (x=0; x<=size_max; ++x)
|
for (x=0; x<=size_max; ++x)
|
||||||
|
@ -672,8 +672,8 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
const png_uint_32 luma = colors[1];
|
png_uint_32 luma = colors[1];
|
||||||
const png_uint_32 alpha = colors[2];
|
png_uint_32 alpha = colors[2];
|
||||||
png_uint_32 x;
|
png_uint_32 x;
|
||||||
|
|
||||||
for (x=0; x<size_max; ++x)
|
for (x=0; x<size_max; ++x)
|
||||||
|
@ -688,9 +688,9 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
const png_uint_32 red = colors[1];
|
png_uint_32 red = colors[1];
|
||||||
const png_uint_32 green = colors[2];
|
png_uint_32 green = colors[2];
|
||||||
const png_uint_32 blue = colors[3];
|
png_uint_32 blue = colors[3];
|
||||||
png_uint_32 x;
|
png_uint_32 x;
|
||||||
|
|
||||||
for (x=0; x<=size_max; ++x)
|
for (x=0; x<=size_max; ++x)
|
||||||
|
@ -707,10 +707,10 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
const png_uint_32 red = colors[1];
|
png_uint_32 red = colors[1];
|
||||||
const png_uint_32 green = colors[2];
|
png_uint_32 green = colors[2];
|
||||||
const png_uint_32 blue = colors[3];
|
png_uint_32 blue = colors[3];
|
||||||
const png_uint_32 alpha = colors[4];
|
png_uint_32 alpha = colors[4];
|
||||||
png_uint_32 x;
|
png_uint_32 x;
|
||||||
|
|
||||||
for (x=0; x<=size_max; ++x)
|
for (x=0; x<=size_max; ++x)
|
||||||
|
@ -812,7 +812,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||||
png_error(png_ptr, "OOM allocating info structure");
|
png_error(png_ptr, "OOM allocating info structure");
|
||||||
|
|
||||||
{
|
{
|
||||||
const unsigned int size =
|
unsigned int size =
|
||||||
image_size_of_type(color_type, bit_depth, colors, small);
|
image_size_of_type(color_type, bit_depth, colors, small);
|
||||||
unsigned int ysize;
|
unsigned int ysize;
|
||||||
png_fixed_point real_gamma = 45455; /* For sRGB */
|
png_fixed_point real_gamma = 45455; /* For sRGB */
|
||||||
|
@ -824,7 +824,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||||
*/
|
*/
|
||||||
if (small)
|
if (small)
|
||||||
{
|
{
|
||||||
const unsigned int pixel_depth =
|
unsigned int pixel_depth =
|
||||||
pixel_depth_of_type(color_type, bit_depth);
|
pixel_depth_of_type(color_type, bit_depth);
|
||||||
|
|
||||||
if (pixel_depth <= 8U)
|
if (pixel_depth <= 8U)
|
||||||
|
@ -950,7 +950,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||||
int passes = 1;
|
int passes = 1;
|
||||||
# endif /* !WRITE_INTERLACING */
|
# endif /* !WRITE_INTERLACING */
|
||||||
int pass;
|
int pass;
|
||||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||||
|
|
||||||
row = malloc(rowbytes);
|
row = malloc(rowbytes);
|
||||||
|
|
||||||
|
@ -1094,7 +1094,7 @@ load_file(png_const_charp name, png_bytepp result)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static png_size_t
|
static size_t
|
||||||
load_fake(png_charp param, png_bytepp profile)
|
load_fake(png_charp param, png_bytepp profile)
|
||||||
{
|
{
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
|
@ -1164,7 +1164,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||||
{
|
{
|
||||||
case '<':
|
case '<':
|
||||||
{
|
{
|
||||||
png_size_t filelen = load_file(params[1]+1, &profile);
|
size_t filelen = load_file(params[1]+1, &profile);
|
||||||
if (filelen > 0xfffffffc) /* Maximum profile length */
|
if (filelen > 0xfffffffc) /* Maximum profile length */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n",
|
fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n",
|
||||||
|
@ -1179,7 +1179,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
{
|
{
|
||||||
png_size_t fake_len = load_fake(params[1], &profile);
|
size_t fake_len = load_fake(params[1], &profile);
|
||||||
|
|
||||||
if (fake_len > 0) /* else a simple parameter */
|
if (fake_len > 0) /* else a simple parameter */
|
||||||
{
|
{
|
||||||
|
@ -1274,7 +1274,7 @@ set_text(png_structp png_ptr, png_infop info_ptr, png_textp text,
|
||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
{
|
{
|
||||||
png_bytep data = NULL;
|
png_bytep data = NULL;
|
||||||
png_size_t fake_len = load_fake(param, &data);
|
size_t fake_len = load_fake(param, &data);
|
||||||
|
|
||||||
if (fake_len > 0) /* else a simple parameter */
|
if (fake_len > 0) /* else a simple parameter */
|
||||||
{
|
{
|
||||||
|
@ -1378,10 +1378,10 @@ static void
|
||||||
insert_sBIT(png_structp png_ptr, png_infop info_ptr, int nparams,
|
insert_sBIT(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||||
png_charpp params)
|
png_charpp params)
|
||||||
{
|
{
|
||||||
const int ct = png_get_color_type(png_ptr, info_ptr);
|
int ct = png_get_color_type(png_ptr, info_ptr);
|
||||||
const int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
|
int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
|
||||||
(ct & PNG_COLOR_MASK_ALPHA ? 1 : 0);
|
(ct & PNG_COLOR_MASK_ALPHA ? 1 : 0);
|
||||||
const unsigned int maxval =
|
unsigned int maxval =
|
||||||
ct & PNG_COLOR_MASK_PALETTE ? 8U : png_get_bit_depth(png_ptr, info_ptr);
|
ct & PNG_COLOR_MASK_PALETTE ? 8U : png_get_bit_depth(png_ptr, info_ptr);
|
||||||
png_color_8 sBIT;
|
png_color_8 sBIT;
|
||||||
|
|
||||||
|
@ -1856,7 +1856,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
/* Check the colors */
|
/* Check the colors */
|
||||||
{
|
{
|
||||||
const unsigned int lim = (color_type == PNG_COLOR_TYPE_PALETTE ? 255U :
|
unsigned int lim = (color_type == PNG_COLOR_TYPE_PALETTE ? 255U :
|
||||||
(1U<<bit_depth)-1);
|
(1U<<bit_depth)-1);
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
|
|
@ -551,7 +551,7 @@ struct display
|
||||||
png_structp original_pp; /* used on the original read */
|
png_structp original_pp; /* used on the original read */
|
||||||
png_infop original_ip; /* set by the original read */
|
png_infop original_ip; /* set by the original read */
|
||||||
|
|
||||||
png_size_t original_rowbytes; /* of the original rows: */
|
size_t original_rowbytes; /* of the original rows: */
|
||||||
png_bytepp original_rows; /* from the original read */
|
png_bytepp original_rows; /* from the original read */
|
||||||
|
|
||||||
/* Original chunks valid */
|
/* Original chunks valid */
|
||||||
|
@ -807,7 +807,7 @@ display_cache_file(struct display *dp, const char *filename)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
||||||
png_size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct buffer_list *last = bp->current;
|
struct buffer_list *last = bp->current;
|
||||||
size_t read_count = bp->read_count;
|
size_t read_count = bp->read_count;
|
||||||
|
@ -855,7 +855,7 @@ buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PNGCBAPI
|
static void PNGCBAPI
|
||||||
read_function(png_structp pp, png_bytep data, png_size_t size)
|
read_function(png_structp pp, png_bytep data, size_t size)
|
||||||
{
|
{
|
||||||
buffer_read(get_dp(pp), get_buffer(pp), data, size);
|
buffer_read(get_dp(pp), get_buffer(pp), data, size);
|
||||||
}
|
}
|
||||||
|
@ -927,7 +927,7 @@ update_display(struct display *dp)
|
||||||
png_structp pp;
|
png_structp pp;
|
||||||
png_infop ip;
|
png_infop ip;
|
||||||
|
|
||||||
/* Now perform the initial read with a 0 tranform. */
|
/* Now perform the initial read with a 0 transform. */
|
||||||
read_png(dp, &dp->original_file, "original read", 0/*no transform*/);
|
read_png(dp, &dp->original_file, "original read", 0/*no transform*/);
|
||||||
|
|
||||||
/* Move the result to the 'original' fields */
|
/* Move the result to the 'original' fields */
|
||||||
|
@ -1267,7 +1267,7 @@ compare_read(struct display *dp, int applied_transforms)
|
||||||
#ifdef PNG_WRITE_PNG_SUPPORTED
|
#ifdef PNG_WRITE_PNG_SUPPORTED
|
||||||
static void
|
static void
|
||||||
buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
||||||
png_size_t size)
|
size_t size)
|
||||||
/* Generic write function used both from the write callback provided to
|
/* Generic write function used both from the write callback provided to
|
||||||
* libpng and from the generic read code.
|
* libpng and from the generic read code.
|
||||||
*/
|
*/
|
||||||
|
@ -1311,7 +1311,7 @@ buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PNGCBAPI
|
static void PNGCBAPI
|
||||||
write_function(png_structp pp, png_bytep data, png_size_t size)
|
write_function(png_structp pp, png_bytep data, size_t size)
|
||||||
{
|
{
|
||||||
buffer_write(get_dp(pp), get_buffer(pp), data, size);
|
buffer_write(get_dp(pp), get_buffer(pp), data, size);
|
||||||
}
|
}
|
||||||
|
@ -1446,7 +1446,7 @@ test_one_file(struct display *dp, const char *filename)
|
||||||
* unsigned, because some transforms are negative on a 16-bit system.
|
* unsigned, because some transforms are negative on a 16-bit system.
|
||||||
*/
|
*/
|
||||||
unsigned int active = dp->active_transforms;
|
unsigned int active = dp->active_transforms;
|
||||||
const int exhaustive = (dp->options & EXHAUSTIVE) != 0;
|
int exhaustive = (dp->options & EXHAUSTIVE) != 0;
|
||||||
unsigned int current = first_transform(active);
|
unsigned int current = first_transform(active);
|
||||||
unsigned int bad_transforms = 0;
|
unsigned int bad_transforms = 0;
|
||||||
unsigned int bad_combo = ~0U; /* bitwise AND of failing transforms */
|
unsigned int bad_combo = ~0U; /* bitwise AND of failing transforms */
|
||||||
|
@ -1572,7 +1572,7 @@ do_test(struct display *dp, const char *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(const int argc, const char * const * const argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* For each file on the command line test it with a range of transforms */
|
/* For each file on the command line test it with a range of transforms */
|
||||||
int option_end, ilog = 0;
|
int option_end, ilog = 0;
|
||||||
|
@ -1674,7 +1674,7 @@ main(const int argc, const char * const * const argv)
|
||||||
/* Here on any return, including failures, except user/internal issues
|
/* Here on any return, including failures, except user/internal issues
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
const int pass = (d.options & STRICT) ?
|
int pass = (d.options & STRICT) ?
|
||||||
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
|
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
|
||||||
|
|
||||||
if (!pass)
|
if (!pass)
|
||||||
|
|
|
@ -372,7 +372,7 @@ print_opts(png_uint_32 opts)
|
||||||
*/
|
*/
|
||||||
#define FORMAT_COUNT 64
|
#define FORMAT_COUNT 64
|
||||||
#define FORMAT_MASK 0x3f
|
#define FORMAT_MASK 0x3f
|
||||||
static PNG_CONST char * PNG_CONST format_names[FORMAT_COUNT] =
|
static const char * const format_names[FORMAT_COUNT] =
|
||||||
{
|
{
|
||||||
"sRGB-gray",
|
"sRGB-gray",
|
||||||
"sRGB-gray+alpha",
|
"sRGB-gray+alpha",
|
||||||
|
@ -578,11 +578,11 @@ typedef struct
|
||||||
int stride_extra;
|
int stride_extra;
|
||||||
FILE *input_file;
|
FILE *input_file;
|
||||||
png_voidp input_memory;
|
png_voidp input_memory;
|
||||||
png_size_t input_memory_size;
|
size_t input_memory_size;
|
||||||
png_bytep buffer;
|
png_bytep buffer;
|
||||||
ptrdiff_t stride;
|
ptrdiff_t stride;
|
||||||
png_size_t bufsize;
|
size_t bufsize;
|
||||||
png_size_t allocsize;
|
size_t allocsize;
|
||||||
char tmpfile_name[32];
|
char tmpfile_name[32];
|
||||||
png_uint_16 colormap[256*4];
|
png_uint_16 colormap[256*4];
|
||||||
}
|
}
|
||||||
|
@ -665,7 +665,7 @@ static void initimage(Image *image, png_uint_32 opts, const char *file_name,
|
||||||
static void
|
static void
|
||||||
allocbuffer(Image *image)
|
allocbuffer(Image *image)
|
||||||
{
|
{
|
||||||
png_size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
|
size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
|
||||||
|
|
||||||
if (size+32 > image->bufsize)
|
if (size+32 > image->bufsize)
|
||||||
{
|
{
|
||||||
|
@ -1142,7 +1142,7 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convertion between pixel formats. The code above effectively eliminates the
|
/* Conversion between pixel formats. The code above effectively eliminates the
|
||||||
* component ordering changes leaving three basic changes:
|
* component ordering changes leaving three basic changes:
|
||||||
*
|
*
|
||||||
* 1) Remove an alpha channel by pre-multiplication or compositing on a
|
* 1) Remove an alpha channel by pre-multiplication or compositing on a
|
||||||
|
@ -2036,7 +2036,7 @@ typedef struct
|
||||||
/* Precalculated values: */
|
/* Precalculated values: */
|
||||||
int in_opaque; /* Value of input alpha that is opaque */
|
int in_opaque; /* Value of input alpha that is opaque */
|
||||||
int is_palette; /* Sample values come from the palette */
|
int is_palette; /* Sample values come from the palette */
|
||||||
int accumulate; /* Accumlate component errors (don't log) */
|
int accumulate; /* Accumulate component errors (don't log) */
|
||||||
int output_8bit; /* Output is 8-bit (else 16-bit) */
|
int output_8bit; /* Output is 8-bit (else 16-bit) */
|
||||||
|
|
||||||
void (*in_gp)(Pixel*, png_const_voidp);
|
void (*in_gp)(Pixel*, png_const_voidp);
|
||||||
|
@ -2346,8 +2346,8 @@ static int
|
||||||
logpixel(const Transform *transform, png_uint_32 x, png_uint_32 y,
|
logpixel(const Transform *transform, png_uint_32 x, png_uint_32 y,
|
||||||
const Pixel *in, const Pixel *calc, const Pixel *out, const char *reason)
|
const Pixel *in, const Pixel *calc, const Pixel *out, const char *reason)
|
||||||
{
|
{
|
||||||
const png_uint_32 in_format = transform->in_image->image.format;
|
png_uint_32 in_format = transform->in_image->image.format;
|
||||||
const png_uint_32 out_format = transform->out_image->image.format;
|
png_uint_32 out_format = transform->out_image->image.format;
|
||||||
|
|
||||||
png_uint_32 back_format = out_format & ~PNG_FORMAT_FLAG_ALPHA;
|
png_uint_32 back_format = out_format & ~PNG_FORMAT_FLAG_ALPHA;
|
||||||
const char *via_linear = "";
|
const char *via_linear = "";
|
||||||
|
@ -2602,12 +2602,12 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||||
ptrdiff_t strideb = b->stride;
|
ptrdiff_t strideb = b->stride;
|
||||||
png_const_bytep rowa = a->buffer+16;
|
png_const_bytep rowa = a->buffer+16;
|
||||||
png_const_bytep rowb = b->buffer+16;
|
png_const_bytep rowb = b->buffer+16;
|
||||||
const png_uint_32 width = a->image.width;
|
png_uint_32 width = a->image.width;
|
||||||
const png_uint_32 height = a->image.height;
|
png_uint_32 height = a->image.height;
|
||||||
const png_uint_32 formata = a->image.format;
|
png_uint_32 formata = a->image.format;
|
||||||
const png_uint_32 formatb = b->image.format;
|
png_uint_32 formatb = b->image.format;
|
||||||
const unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
|
unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
|
||||||
const unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
|
unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
|
||||||
int alpha_added, alpha_removed;
|
int alpha_added, alpha_removed;
|
||||||
int bchannels;
|
int bchannels;
|
||||||
png_uint_32 y;
|
png_uint_32 y;
|
||||||
|
@ -2726,7 +2726,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If reqested copy the error values back from the Transform. */
|
/* If requested, copy the error values back from the Transform. */
|
||||||
if (a->opts & ACCUMULATE)
|
if (a->opts & ACCUMULATE)
|
||||||
{
|
{
|
||||||
tr.error_ptr[0] = tr.error[0];
|
tr.error_ptr[0] = tr.error[0];
|
||||||
|
@ -2790,8 +2790,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||||
(formata & (formatb ^ PNG_FORMAT_FLAG_COLOR) & PNG_FORMAT_FLAG_COLOR)))
|
(formata & (formatb ^ PNG_FORMAT_FLAG_COLOR) & PNG_FORMAT_FLAG_COLOR)))
|
||||||
{
|
{
|
||||||
/* Was an alpha channel changed? */
|
/* Was an alpha channel changed? */
|
||||||
const png_uint_32 alpha_changed = (formata ^ formatb) &
|
png_uint_32 alpha_changed = (formata ^ formatb) & PNG_FORMAT_FLAG_ALPHA;
|
||||||
PNG_FORMAT_FLAG_ALPHA;
|
|
||||||
|
|
||||||
/* Was an alpha channel removed? (The third test.) If so the direct
|
/* Was an alpha channel removed? (The third test.) If so the direct
|
||||||
* comparison is only possible if the input alpha is opaque.
|
* comparison is only possible if the input alpha is opaque.
|
||||||
|
@ -2932,7 +2931,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If reqested copy the error values back from the Transform. */
|
/* If requested, copy the error values back from the Transform. */
|
||||||
if (a->opts & ACCUMULATE)
|
if (a->opts & ACCUMULATE)
|
||||||
{
|
{
|
||||||
tr.error_ptr[0] = tr.error[0];
|
tr.error_ptr[0] = tr.error[0];
|
||||||
|
@ -3627,7 +3626,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
if (arg[0] == '-')
|
if (arg[0] == '-')
|
||||||
{
|
{
|
||||||
const int term = (arg[1] == '0' ? 0 : '\n');
|
int term = (arg[1] == '0' ? 0 : '\n');
|
||||||
unsigned int ich = 0;
|
unsigned int ich = 0;
|
||||||
|
|
||||||
/* Loop reading files, use a static buffer to simplify this and just
|
/* Loop reading files, use a static buffer to simplify this and just
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
defined(PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED)
|
defined(PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
|
|
||||||
#if PNG_LIBPNG_VER < 10500
|
#if PNG_LIBPNG_VER < 10500
|
||||||
/* This deliberately lacks the PNG_CONST. */
|
/* This deliberately lacks the const. */
|
||||||
typedef png_byte *png_const_bytep;
|
typedef png_byte *png_const_bytep;
|
||||||
|
|
||||||
/* This is copied from 1.5.1 png.h: */
|
/* This is copied from 1.5.1 png.h: */
|
||||||
|
@ -85,7 +85,7 @@ typedef png_byte *png_const_bytep;
|
||||||
#define PNG_WRITE_16BIT_SUPPORTED
|
#define PNG_WRITE_16BIT_SUPPORTED
|
||||||
#define PNG_READ_16BIT_SUPPORTED
|
#define PNG_READ_16BIT_SUPPORTED
|
||||||
|
|
||||||
/* This comes from pnglibconf.h afer 1.5: */
|
/* This comes from pnglibconf.h after 1.5: */
|
||||||
#define PNG_FP_1 100000
|
#define PNG_FP_1 100000
|
||||||
#define PNG_GAMMA_THRESHOLD_FIXED\
|
#define PNG_GAMMA_THRESHOLD_FIXED\
|
||||||
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define _POSIX_SOURCE 1
|
#define _POSIX_SOURCE 1
|
||||||
#define _ISOC99_SOURCE 1 /* For floating point */
|
#define _ISOC99_SOURCE 1 /* For floating point */
|
||||||
#define _GNU_SOURCE 1 /* For the floating point exception extension */
|
#define _GNU_SOURCE 1 /* For the floating point exception extension */
|
||||||
|
#define _BSD_SOURCE 1 /* For the floating point exception extension */
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -102,7 +103,7 @@ typedef png_byte *png_const_bytep;
|
||||||
#define PNG_WRITE_16BIT_SUPPORTED
|
#define PNG_WRITE_16BIT_SUPPORTED
|
||||||
#define PNG_READ_16BIT_SUPPORTED
|
#define PNG_READ_16BIT_SUPPORTED
|
||||||
|
|
||||||
/* This comes from pnglibconf.h afer 1.5: */
|
/* This comes from pnglibconf.h after 1.5: */
|
||||||
#define PNG_FP_1 100000
|
#define PNG_FP_1 100000
|
||||||
#define PNG_GAMMA_THRESHOLD_FIXED\
|
#define PNG_GAMMA_THRESHOLD_FIXED\
|
||||||
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
||||||
|
@ -711,7 +712,7 @@ typedef struct png_store_file
|
||||||
unsigned int IDAT_bits; /* Number of bits in IDAT size */
|
unsigned int IDAT_bits; /* Number of bits in IDAT size */
|
||||||
png_uint_32 IDAT_size; /* Total size of IDAT data */
|
png_uint_32 IDAT_size; /* Total size of IDAT data */
|
||||||
png_uint_32 id; /* must be correct (see FILEID) */
|
png_uint_32 id; /* must be correct (see FILEID) */
|
||||||
png_size_t datacount; /* In this (the last) buffer */
|
size_t datacount; /* In this (the last) buffer */
|
||||||
png_store_buffer data; /* Last buffer in file */
|
png_store_buffer data; /* Last buffer in file */
|
||||||
int npalette; /* Number of entries in palette */
|
int npalette; /* Number of entries in palette */
|
||||||
store_palette_entry* palette; /* May be NULL */
|
store_palette_entry* palette; /* May be NULL */
|
||||||
|
@ -777,10 +778,10 @@ typedef struct png_store
|
||||||
png_infop piread;
|
png_infop piread;
|
||||||
png_store_file* current; /* Set when reading */
|
png_store_file* current; /* Set when reading */
|
||||||
png_store_buffer* next; /* Set when reading */
|
png_store_buffer* next; /* Set when reading */
|
||||||
png_size_t readpos; /* Position in *next */
|
size_t readpos; /* Position in *next */
|
||||||
png_byte* image; /* Buffer for reading interlaced images */
|
png_byte* image; /* Buffer for reading interlaced images */
|
||||||
png_size_t cb_image; /* Size of this buffer */
|
size_t cb_image; /* Size of this buffer */
|
||||||
png_size_t cb_row; /* Row size of the image(s) */
|
size_t cb_row; /* Row size of the image(s) */
|
||||||
uLong IDAT_crc;
|
uLong IDAT_crc;
|
||||||
png_uint_32 IDAT_len; /* Used when re-chunking IDAT chunks */
|
png_uint_32 IDAT_len; /* Used when re-chunking IDAT chunks */
|
||||||
png_uint_32 IDAT_pos; /* Used when re-chunking IDAT chunks */
|
png_uint_32 IDAT_pos; /* Used when re-chunking IDAT chunks */
|
||||||
|
@ -791,7 +792,7 @@ typedef struct png_store
|
||||||
png_store_file* saved;
|
png_store_file* saved;
|
||||||
png_structp pwrite; /* Used when writing a new file */
|
png_structp pwrite; /* Used when writing a new file */
|
||||||
png_infop piwrite;
|
png_infop piwrite;
|
||||||
png_size_t writepos; /* Position in .new */
|
size_t writepos; /* Position in .new */
|
||||||
char wname[FILE_NAME_SIZE];
|
char wname[FILE_NAME_SIZE];
|
||||||
png_store_buffer new; /* The end of the new PNG file being written. */
|
png_store_buffer new; /* The end of the new PNG file being written. */
|
||||||
store_pool write_memory_pool;
|
store_pool write_memory_pool;
|
||||||
|
@ -961,7 +962,7 @@ bits_of(png_uint_32 num)
|
||||||
return b; /* 0..32 */
|
return b; /* 0..32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Main interface to file storeage, after writing a new PNG file (see the API
|
/* Main interface to file storage, after writing a new PNG file (see the API
|
||||||
* below) call store_storefile to store the result with the given name and id.
|
* below) call store_storefile to store the result with the given name and id.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
@ -1125,7 +1126,7 @@ static png_bytep
|
||||||
store_image_row(const png_store* ps, png_const_structp pp, int nImage,
|
store_image_row(const png_store* ps, png_const_structp pp, int nImage,
|
||||||
png_uint_32 y)
|
png_uint_32 y)
|
||||||
{
|
{
|
||||||
png_size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
|
size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
|
||||||
|
|
||||||
if (ps->image == NULL)
|
if (ps->image == NULL)
|
||||||
png_error(pp, "no allocated image");
|
png_error(pp, "no allocated image");
|
||||||
|
@ -1160,9 +1161,9 @@ store_image_free(png_store *ps, png_const_structp pp)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
store_ensure_image(png_store *ps, png_const_structp pp, int nImages,
|
store_ensure_image(png_store *ps, png_const_structp pp, int nImages,
|
||||||
png_size_t cbRow, png_uint_32 cRows)
|
size_t cbRow, png_uint_32 cRows)
|
||||||
{
|
{
|
||||||
png_size_t cb = nImages * cRows * (cbRow + 5);
|
size_t cb = nImages * cRows * (cbRow + 5);
|
||||||
|
|
||||||
if (ps->cb_image < cb)
|
if (ps->cb_image < cb)
|
||||||
{
|
{
|
||||||
|
@ -1234,7 +1235,7 @@ store_image_check(const png_store* ps, png_const_structp pp, int iImage)
|
||||||
png_error(pp, "image overwrite");
|
png_error(pp, "image overwrite");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_size_t cbRow = ps->cb_row;
|
size_t cbRow = ps->cb_row;
|
||||||
png_uint_32 rows = ps->image_h;
|
png_uint_32 rows = ps->image_h;
|
||||||
|
|
||||||
image += iImage * (cbRow+5) * ps->image_h;
|
image += iImage * (cbRow+5) * ps->image_h;
|
||||||
|
@ -1278,7 +1279,7 @@ valid_chunktype(png_uint_32 chunktype)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PNGCBAPI
|
static void PNGCBAPI
|
||||||
store_write(png_structp ppIn, png_bytep pb, png_size_t st)
|
store_write(png_structp ppIn, png_bytep pb, size_t st)
|
||||||
{
|
{
|
||||||
png_const_structp pp = ppIn;
|
png_const_structp pp = ppIn;
|
||||||
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
||||||
|
@ -1346,13 +1347,13 @@ store_write(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||||
|
|
||||||
else /* chunkpos >= 8 */
|
else /* chunkpos >= 8 */
|
||||||
{
|
{
|
||||||
png_size_t cb = st;
|
size_t cb = st;
|
||||||
|
|
||||||
if (cb > STORE_BUFFER_SIZE - writepos)
|
if (cb > STORE_BUFFER_SIZE - writepos)
|
||||||
cb = STORE_BUFFER_SIZE - writepos;
|
cb = STORE_BUFFER_SIZE - writepos;
|
||||||
|
|
||||||
if (cb > chunklen - chunkpos/* bytes left in chunk*/)
|
if (cb > chunklen - chunkpos/* bytes left in chunk*/)
|
||||||
cb = (png_size_t)/*SAFE*/(chunklen - chunkpos);
|
cb = (size_t)/*SAFE*/(chunklen - chunkpos);
|
||||||
|
|
||||||
memcpy(ps->new.buffer + writepos, pb, cb);
|
memcpy(ps->new.buffer + writepos, pb, cb);
|
||||||
chunkpos += (png_uint_32)/*SAFE*/cb;
|
chunkpos += (png_uint_32)/*SAFE*/cb;
|
||||||
|
@ -1440,7 +1441,7 @@ store_read_buffer_next(png_store *ps)
|
||||||
* during progressive read, where the io_ptr is set internally by libpng.
|
* during progressive read, where the io_ptr is set internally by libpng.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
|
store_read_imp(png_store *ps, png_bytep pb, size_t st)
|
||||||
{
|
{
|
||||||
if (ps->current == NULL || ps->next == NULL)
|
if (ps->current == NULL || ps->next == NULL)
|
||||||
png_error(ps->pread, "store state damaged");
|
png_error(ps->pread, "store state damaged");
|
||||||
|
@ -1463,14 +1464,13 @@ store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static png_size_t
|
static size_t
|
||||||
store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
store_read_chunk(png_store *ps, png_bytep pb, size_t max, size_t min)
|
||||||
const png_size_t min)
|
|
||||||
{
|
{
|
||||||
png_uint_32 chunklen = ps->chunklen;
|
png_uint_32 chunklen = ps->chunklen;
|
||||||
png_uint_32 chunktype = ps->chunktype;
|
png_uint_32 chunktype = ps->chunktype;
|
||||||
png_uint_32 chunkpos = ps->chunkpos;
|
png_uint_32 chunkpos = ps->chunkpos;
|
||||||
png_size_t st = max;
|
size_t st = max;
|
||||||
|
|
||||||
if (st > 0) do
|
if (st > 0) do
|
||||||
{
|
{
|
||||||
|
@ -1601,8 +1601,8 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||||
|
|
||||||
store_read_imp(ps, pb, avail);
|
store_read_imp(ps, pb, avail);
|
||||||
ps->IDAT_crc = crc32(ps->IDAT_crc, pb, avail);
|
ps->IDAT_crc = crc32(ps->IDAT_crc, pb, avail);
|
||||||
pb += (png_size_t)/*SAFE*/avail;
|
pb += (size_t)/*SAFE*/avail;
|
||||||
st -= (png_size_t)/*SAFE*/avail;
|
st -= (size_t)/*SAFE*/avail;
|
||||||
chunkpos += (png_uint_32)/*SAFE*/avail;
|
chunkpos += (png_uint_32)/*SAFE*/avail;
|
||||||
IDAT_size -= (png_uint_32)/*SAFE*/avail;
|
IDAT_size -= (png_uint_32)/*SAFE*/avail;
|
||||||
IDAT_pos += (png_uint_32)/*SAFE*/avail;
|
IDAT_pos += (png_uint_32)/*SAFE*/avail;
|
||||||
|
@ -1669,10 +1669,10 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||||
|
|
||||||
else /* Return chunk bytes, including the CRC */
|
else /* Return chunk bytes, including the CRC */
|
||||||
{
|
{
|
||||||
png_size_t avail = st;
|
size_t avail = st;
|
||||||
|
|
||||||
if (avail > chunklen - chunkpos)
|
if (avail > chunklen - chunkpos)
|
||||||
avail = (png_size_t)/*SAFE*/(chunklen - chunkpos);
|
avail = (size_t)/*SAFE*/(chunklen - chunkpos);
|
||||||
|
|
||||||
store_read_imp(ps, pb, avail);
|
store_read_imp(ps, pb, avail);
|
||||||
pb += avail;
|
pb += avail;
|
||||||
|
@ -1698,7 +1698,7 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PNGCBAPI
|
static void PNGCBAPI
|
||||||
store_read(png_structp ppIn, png_bytep pb, png_size_t st)
|
store_read(png_structp ppIn, png_bytep pb, size_t st)
|
||||||
{
|
{
|
||||||
png_const_structp pp = ppIn;
|
png_const_structp pp = ppIn;
|
||||||
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
||||||
|
@ -1724,7 +1724,7 @@ store_progressive_read(png_store *ps, png_structp pp, png_infop pi)
|
||||||
while (store_read_buffer_avail(ps) > 0)
|
while (store_read_buffer_avail(ps) > 0)
|
||||||
{
|
{
|
||||||
static png_uint_32 noise = 2;
|
static png_uint_32 noise = 2;
|
||||||
png_size_t cb;
|
size_t cb;
|
||||||
png_byte buffer[512];
|
png_byte buffer[512];
|
||||||
|
|
||||||
/* Generate 15 more bits of stuff: */
|
/* Generate 15 more bits of stuff: */
|
||||||
|
@ -2590,7 +2590,7 @@ static double digitize(double value, int depth, int do_round)
|
||||||
* rounding and 'do_round' should be 1, if it is 0 the digitized value will
|
* rounding and 'do_round' should be 1, if it is 0 the digitized value will
|
||||||
* be truncated.
|
* be truncated.
|
||||||
*/
|
*/
|
||||||
const unsigned int digitization_factor = (1U << depth) -1;
|
unsigned int digitization_factor = (1U << depth) - 1;
|
||||||
|
|
||||||
/* Limiting the range is done as a convenience to the caller - it's easier to
|
/* Limiting the range is done as a convenience to the caller - it's easier to
|
||||||
* do it once here than every time at the call site.
|
* do it once here than every time at the call site.
|
||||||
|
@ -2991,7 +2991,7 @@ modifier_setbuffer(png_modifier *pm)
|
||||||
* png_struct.
|
* png_struct.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
modifier_read_imp(png_modifier *pm, png_bytep pb, size_t st)
|
||||||
{
|
{
|
||||||
while (st > 0)
|
while (st > 0)
|
||||||
{
|
{
|
||||||
|
@ -3137,7 +3137,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||||
*/
|
*/
|
||||||
if (len+12 <= sizeof pm->buffer)
|
if (len+12 <= sizeof pm->buffer)
|
||||||
{
|
{
|
||||||
png_size_t s = len+12-pm->buffer_count;
|
size_t s = len+12-pm->buffer_count;
|
||||||
store_read_chunk(&pm->this, pm->buffer+pm->buffer_count, s, s);
|
store_read_chunk(&pm->this, pm->buffer+pm->buffer_count, s, s);
|
||||||
pm->buffer_count = len+12;
|
pm->buffer_count = len+12;
|
||||||
|
|
||||||
|
@ -3196,7 +3196,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||||
|
|
||||||
/* The callback: */
|
/* The callback: */
|
||||||
static void PNGCBAPI
|
static void PNGCBAPI
|
||||||
modifier_read(png_structp ppIn, png_bytep pb, png_size_t st)
|
modifier_read(png_structp ppIn, png_bytep pb, size_t st)
|
||||||
{
|
{
|
||||||
png_const_structp pp = ppIn;
|
png_const_structp pp = ppIn;
|
||||||
png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp));
|
png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp));
|
||||||
|
@ -3226,7 +3226,7 @@ modifier_progressive_read(png_modifier *pm, png_structp pp, png_infop pi)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
static png_uint_32 noise = 1;
|
static png_uint_32 noise = 1;
|
||||||
png_size_t cb, cbAvail;
|
size_t cb, cbAvail;
|
||||||
png_byte buffer[512];
|
png_byte buffer[512];
|
||||||
|
|
||||||
/* Generate 15 more bits of stuff: */
|
/* Generate 15 more bits of stuff: */
|
||||||
|
@ -3688,8 +3688,8 @@ init_standard_palette(png_store *ps, png_structp pp, png_infop pi, int npalette,
|
||||||
|
|
||||||
#ifdef PNG_WRITE_tRNS_SUPPORTED
|
#ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||||
static void
|
static void
|
||||||
set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
|
set_random_tRNS(png_structp pp, png_infop pi, png_byte colour_type,
|
||||||
const int bit_depth)
|
int bit_depth)
|
||||||
{
|
{
|
||||||
/* To make this useful the tRNS color needs to match at least one pixel.
|
/* To make this useful the tRNS color needs to match at least one pixel.
|
||||||
* Random values are fine for gray, including the 16-bit case where we know
|
* Random values are fine for gray, including the 16-bit case where we know
|
||||||
|
@ -3697,7 +3697,7 @@ set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
|
||||||
* method as only 65536 different RGB values are generated.
|
* method as only 65536 different RGB values are generated.
|
||||||
*/
|
*/
|
||||||
png_color_16 tRNS;
|
png_color_16 tRNS;
|
||||||
const png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
|
png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
|
||||||
|
|
||||||
R8(tRNS); /* makes unset fields random */
|
R8(tRNS); /* makes unset fields random */
|
||||||
|
|
||||||
|
@ -4338,7 +4338,7 @@ make_size_image(png_store* const ps, png_byte const colour_type,
|
||||||
|
|
||||||
/* Make a name and get an appropriate id for the store: */
|
/* Make a name and get an appropriate id for the store: */
|
||||||
char name[FILE_NAME_SIZE];
|
char name[FILE_NAME_SIZE];
|
||||||
const png_uint_32 id = FILEID(colour_type, bit_depth, 0/*palette*/,
|
png_uint_32 id = FILEID(colour_type, bit_depth, 0/*palette*/,
|
||||||
interlace_type, w, h, do_interlace);
|
interlace_type, w, h, do_interlace);
|
||||||
|
|
||||||
standard_name_from_id(name, sizeof name, 0, id);
|
standard_name_from_id(name, sizeof name, 0, id);
|
||||||
|
@ -4414,7 +4414,7 @@ make_size_image(png_store* const ps, png_byte const colour_type,
|
||||||
for (pass=0; pass<npasses; ++pass)
|
for (pass=0; pass<npasses; ++pass)
|
||||||
{
|
{
|
||||||
/* The following two are for checking the macros: */
|
/* The following two are for checking the macros: */
|
||||||
const png_uint_32 wPass = PNG_PASS_COLS(w, pass);
|
png_uint_32 wPass = PNG_PASS_COLS(w, pass);
|
||||||
|
|
||||||
/* If do_interlace is set we don't call png_write_row for every
|
/* If do_interlace is set we don't call png_write_row for every
|
||||||
* row because some of them are empty. In fact, for a 1x1 image,
|
* row because some of them are empty. In fact, for a 1x1 image,
|
||||||
|
@ -4646,7 +4646,7 @@ make_error(png_store* const ps, png_byte const colour_type,
|
||||||
Try
|
Try
|
||||||
{
|
{
|
||||||
png_infop pi;
|
png_infop pi;
|
||||||
const png_structp pp = set_store_for_write(ps, &pi, name);
|
png_structp pp = set_store_for_write(ps, &pi, name);
|
||||||
png_uint_32 w, h;
|
png_uint_32 w, h;
|
||||||
gnu_volatile(pp)
|
gnu_volatile(pp)
|
||||||
|
|
||||||
|
@ -4706,7 +4706,7 @@ make_error(png_store* const ps, png_byte const colour_type,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Now write the whole image, just to make sure that the detected, or
|
/* Now write the whole image, just to make sure that the detected, or
|
||||||
* undetected, errro has not created problems inside libpng. This
|
* undetected, error has not created problems inside libpng. This
|
||||||
* doesn't work if there was a png_error in png_write_info because that
|
* doesn't work if there was a png_error in png_write_info because that
|
||||||
* can abort before PLTE was written.
|
* can abort before PLTE was written.
|
||||||
*/
|
*/
|
||||||
|
@ -5001,7 +5001,7 @@ standard_display_init(standard_display *dp, png_store* ps, png_uint_32 id,
|
||||||
dp->npalette = 0;
|
dp->npalette = 0;
|
||||||
/* Preset the transparent color to black: */
|
/* Preset the transparent color to black: */
|
||||||
memset(&dp->transparent, 0, sizeof dp->transparent);
|
memset(&dp->transparent, 0, sizeof dp->transparent);
|
||||||
/* Preset the palette to full intensity/opaque througout: */
|
/* Preset the palette to full intensity/opaque throughout: */
|
||||||
memset(dp->palette, 0xff, sizeof dp->palette);
|
memset(dp->palette, 0xff, sizeof dp->palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5270,7 +5270,7 @@ standard_info_part1(standard_display *dp, png_structp pp, png_infop pi)
|
||||||
*/
|
*/
|
||||||
standard_palette_validate(dp, pp, pi);
|
standard_palette_validate(dp, pp, pi);
|
||||||
|
|
||||||
/* In any case always check for a tranparent color (notice that the
|
/* In any case always check for a transparent color (notice that the
|
||||||
* colour type 3 case must not give a successful return on the get_tRNS call
|
* colour type 3 case must not give a successful return on the get_tRNS call
|
||||||
* with these arguments!)
|
* with these arguments!)
|
||||||
*/
|
*/
|
||||||
|
@ -5469,13 +5469,13 @@ progressive_row(png_structp ppIn, png_bytep new_row, png_uint_32 y, int pass)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sequential_row(standard_display *dp, png_structp pp, png_infop pi,
|
sequential_row(standard_display *dp, png_structp pp, png_infop pi,
|
||||||
const int iImage, const int iDisplay)
|
int iImage, int iDisplay)
|
||||||
{
|
{
|
||||||
const int npasses = dp->npasses;
|
int npasses = dp->npasses;
|
||||||
const int do_interlace = dp->do_interlace &&
|
int do_interlace = dp->do_interlace &&
|
||||||
dp->interlace_type == PNG_INTERLACE_ADAM7;
|
dp->interlace_type == PNG_INTERLACE_ADAM7;
|
||||||
const png_uint_32 height = standard_height(pp, dp->id);
|
png_uint_32 height = standard_height(pp, dp->id);
|
||||||
const png_uint_32 width = standard_width(pp, dp->id);
|
png_uint_32 width = standard_width(pp, dp->id);
|
||||||
const png_store* ps = dp->ps;
|
const png_store* ps = dp->ps;
|
||||||
int pass;
|
int pass;
|
||||||
|
|
||||||
|
@ -5870,7 +5870,7 @@ test_size(png_modifier* const pm, png_byte const colour_type,
|
||||||
*/
|
*/
|
||||||
static const png_byte hinc[] = {1, 3, 11, 1, 5};
|
static const png_byte hinc[] = {1, 3, 11, 1, 5};
|
||||||
static const png_byte winc[] = {1, 9, 5, 7, 1};
|
static const png_byte winc[] = {1, 9, 5, 7, 1};
|
||||||
const int save_bdlo = bdlo;
|
int save_bdlo = bdlo;
|
||||||
|
|
||||||
for (; bdlo <= bdhi; ++bdlo)
|
for (; bdlo <= bdhi; ++bdlo)
|
||||||
{
|
{
|
||||||
|
@ -6078,12 +6078,12 @@ image_pixel_init(image_pixel *this, png_const_bytep row, png_byte colour_type,
|
||||||
png_byte bit_depth, png_uint_32 x, store_palette palette,
|
png_byte bit_depth, png_uint_32 x, store_palette palette,
|
||||||
const image_pixel *format /*from pngvalid transform of input*/)
|
const image_pixel *format /*from pngvalid transform of input*/)
|
||||||
{
|
{
|
||||||
const png_byte sample_depth = (png_byte)(colour_type ==
|
png_byte sample_depth =
|
||||||
PNG_COLOR_TYPE_PALETTE ? 8 : bit_depth);
|
(png_byte)(colour_type == PNG_COLOR_TYPE_PALETTE ? 8 : bit_depth);
|
||||||
const unsigned int max = (1U<<sample_depth)-1;
|
unsigned int max = (1U<<sample_depth)-1;
|
||||||
const int swap16 = (format != 0 && format->swap16);
|
int swap16 = (format != 0 && format->swap16);
|
||||||
const int littleendian = (format != 0 && format->littleendian);
|
int littleendian = (format != 0 && format->littleendian);
|
||||||
const int sig_bits = (format != 0 && format->sig_bits);
|
int sig_bits = (format != 0 && format->sig_bits);
|
||||||
|
|
||||||
/* Initially just set everything to the same number and the alpha to opaque.
|
/* Initially just set everything to the same number and the alpha to opaque.
|
||||||
* Note that this currently assumes a simple palette where entry x has colour
|
* Note that this currently assumes a simple palette where entry x has colour
|
||||||
|
@ -6101,7 +6101,7 @@ image_pixel_init(image_pixel *this, png_const_bytep row, png_byte colour_type,
|
||||||
/* This permits the caller to default to the sample value. */
|
/* This permits the caller to default to the sample value. */
|
||||||
if (palette != 0)
|
if (palette != 0)
|
||||||
{
|
{
|
||||||
const unsigned int i = this->palette_index;
|
unsigned int i = this->palette_index;
|
||||||
|
|
||||||
this->red = palette[i].red;
|
this->red = palette[i].red;
|
||||||
this->green = palette[i].green;
|
this->green = palette[i].green;
|
||||||
|
@ -6432,8 +6432,8 @@ static void
|
||||||
image_transform_mod_end(const image_transform *this, image_pixel *that,
|
image_transform_mod_end(const image_transform *this, image_pixel *that,
|
||||||
png_const_structp pp, const transform_display *display)
|
png_const_structp pp, const transform_display *display)
|
||||||
{
|
{
|
||||||
const unsigned int scale = (1U<<that->sample_depth)-1;
|
unsigned int scale = (1U<<that->sample_depth)-1;
|
||||||
const int sig_bits = that->sig_bits;
|
int sig_bits = that->sig_bits;
|
||||||
|
|
||||||
UNUSED(this)
|
UNUSED(this)
|
||||||
UNUSED(pp)
|
UNUSED(pp)
|
||||||
|
@ -6756,19 +6756,19 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
|
||||||
{
|
{
|
||||||
/* Constants for the loop below: */
|
/* Constants for the loop below: */
|
||||||
const png_store* const ps = dp->this.ps;
|
const png_store* const ps = dp->this.ps;
|
||||||
const png_byte in_ct = dp->this.colour_type;
|
png_byte in_ct = dp->this.colour_type;
|
||||||
const png_byte in_bd = dp->this.bit_depth;
|
png_byte in_bd = dp->this.bit_depth;
|
||||||
const png_uint_32 w = dp->this.w;
|
png_uint_32 w = dp->this.w;
|
||||||
const png_uint_32 h = dp->this.h;
|
png_uint_32 h = dp->this.h;
|
||||||
const png_byte out_ct = dp->output_colour_type;
|
png_byte out_ct = dp->output_colour_type;
|
||||||
const png_byte out_bd = dp->output_bit_depth;
|
png_byte out_bd = dp->output_bit_depth;
|
||||||
const png_byte sample_depth = (png_byte)(out_ct ==
|
png_byte sample_depth =
|
||||||
PNG_COLOR_TYPE_PALETTE ? 8 : out_bd);
|
(png_byte)(out_ct == PNG_COLOR_TYPE_PALETTE ? 8 : out_bd);
|
||||||
const png_byte red_sBIT = dp->this.red_sBIT;
|
png_byte red_sBIT = dp->this.red_sBIT;
|
||||||
const png_byte green_sBIT = dp->this.green_sBIT;
|
png_byte green_sBIT = dp->this.green_sBIT;
|
||||||
const png_byte blue_sBIT = dp->this.blue_sBIT;
|
png_byte blue_sBIT = dp->this.blue_sBIT;
|
||||||
const png_byte alpha_sBIT = dp->this.alpha_sBIT;
|
png_byte alpha_sBIT = dp->this.alpha_sBIT;
|
||||||
const int have_tRNS = dp->this.is_transparent;
|
int have_tRNS = dp->this.is_transparent;
|
||||||
double digitization_error;
|
double digitization_error;
|
||||||
|
|
||||||
store_palette out_palette;
|
store_palette out_palette;
|
||||||
|
@ -6780,7 +6780,7 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
|
||||||
store_image_check(dp->this.ps, pp, 0);
|
store_image_check(dp->this.ps, pp, 0);
|
||||||
|
|
||||||
/* Read the palette corresponding to the output if the output colour type
|
/* Read the palette corresponding to the output if the output colour type
|
||||||
* indicates a palette, othewise set out_palette to garbage.
|
* indicates a palette, otherwise set out_palette to garbage.
|
||||||
*/
|
*/
|
||||||
if (out_ct == PNG_COLOR_TYPE_PALETTE)
|
if (out_ct == PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
|
@ -6929,7 +6929,7 @@ transform_end(png_structp ppIn, png_infop pi)
|
||||||
|
|
||||||
/* A single test run. */
|
/* A single test run. */
|
||||||
static void
|
static void
|
||||||
transform_test(png_modifier *pmIn, const png_uint_32 idIn,
|
transform_test(png_modifier *pmIn, png_uint_32 idIn,
|
||||||
const image_transform* transform_listIn, const char * const name)
|
const image_transform* transform_listIn, const char * const name)
|
||||||
{
|
{
|
||||||
transform_display d;
|
transform_display d;
|
||||||
|
@ -7764,7 +7764,7 @@ static void
|
||||||
image_transform_png_set_rgb_to_gray_set(const image_transform *this,
|
image_transform_png_set_rgb_to_gray_set(const image_transform *this,
|
||||||
transform_display *that, png_structp pp, png_infop pi)
|
transform_display *that, png_structp pp, png_infop pi)
|
||||||
{
|
{
|
||||||
const int error_action = 1; /* no error, no defines in png.h */
|
int error_action = 1; /* no error, no defines in png.h */
|
||||||
|
|
||||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
png_set_rgb_to_gray(pp, error_action, data.red_to_set, data.green_to_set);
|
png_set_rgb_to_gray(pp, error_action, data.red_to_set, data.green_to_set);
|
||||||
|
@ -7905,10 +7905,10 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||||
# if DIGITIZE
|
# if DIGITIZE
|
||||||
{
|
{
|
||||||
png_modifier *pm = display->pm;
|
png_modifier *pm = display->pm;
|
||||||
const unsigned int sample_depth = that->sample_depth;
|
unsigned int sample_depth = that->sample_depth;
|
||||||
const unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
|
unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
|
||||||
sample_depth);
|
sample_depth);
|
||||||
const unsigned int gamma_depth =
|
unsigned int gamma_depth =
|
||||||
(sample_depth == 16 ?
|
(sample_depth == 16 ?
|
||||||
display->max_gamma_8 :
|
display->max_gamma_8 :
|
||||||
(pm->assume_16_bit_calculations ?
|
(pm->assume_16_bit_calculations ?
|
||||||
|
@ -7991,7 +7991,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||||
/* Now calculate the actual gray values. Although the error in the
|
/* Now calculate the actual gray values. Although the error in the
|
||||||
* coefficients depends on whether they were specified on the command
|
* coefficients depends on whether they were specified on the command
|
||||||
* line (in which case truncation to 15 bits happened) or not (rounding
|
* line (in which case truncation to 15 bits happened) or not (rounding
|
||||||
* was used) the maxium error in an individual coefficient is always
|
* was used) the maximum error in an individual coefficient is always
|
||||||
* 2/32768, because even in the rounding case the requirement that
|
* 2/32768, because even in the rounding case the requirement that
|
||||||
* coefficients add up to 32768 can cause a larger rounding error.
|
* coefficients add up to 32768 can cause a larger rounding error.
|
||||||
*
|
*
|
||||||
|
@ -8002,7 +8002,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||||
b * data.blue_coefficient;
|
b * data.blue_coefficient;
|
||||||
|
|
||||||
{
|
{
|
||||||
const int do_round = data.gamma != 1 || calc_depth == 16;
|
int do_round = data.gamma != 1 || calc_depth == 16;
|
||||||
const double ce = 2. / 32768;
|
const double ce = 2. / 32768;
|
||||||
|
|
||||||
graylo = DD(rlo * (data.red_coefficient-ce) +
|
graylo = DD(rlo * (data.red_coefficient-ce) +
|
||||||
|
@ -8207,7 +8207,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||||
that->bluef = that->greenf = that->redf = gray;
|
that->bluef = that->greenf = that->redf = gray;
|
||||||
that->bluee = that->greene = that->rede = err;
|
that->bluee = that->greene = that->rede = err;
|
||||||
|
|
||||||
/* The sBIT is the minium of the three colour channel sBITs. */
|
/* The sBIT is the minimum of the three colour channel sBITs. */
|
||||||
if (that->red_sBIT > that->green_sBIT)
|
if (that->red_sBIT > that->green_sBIT)
|
||||||
that->red_sBIT = that->green_sBIT;
|
that->red_sBIT = that->green_sBIT;
|
||||||
if (that->red_sBIT > that->blue_sBIT)
|
if (that->red_sBIT > that->blue_sBIT)
|
||||||
|
@ -8626,7 +8626,7 @@ image_transform_png_set_filler_mod(const image_transform *this,
|
||||||
(that->colour_type == PNG_COLOR_TYPE_RGB ||
|
(that->colour_type == PNG_COLOR_TYPE_RGB ||
|
||||||
that->colour_type == PNG_COLOR_TYPE_GRAY))
|
that->colour_type == PNG_COLOR_TYPE_GRAY))
|
||||||
{
|
{
|
||||||
const unsigned int max = (1U << that->bit_depth)-1;
|
unsigned int max = (1U << that->bit_depth)-1;
|
||||||
that->alpha = data.filler & max;
|
that->alpha = data.filler & max;
|
||||||
that->alphaf = ((double)that->alpha) / max;
|
that->alphaf = ((double)that->alpha) / max;
|
||||||
that->alphae = 0;
|
that->alphae = 0;
|
||||||
|
@ -8693,7 +8693,7 @@ image_transform_png_set_add_alpha_mod(const image_transform *this,
|
||||||
(that->colour_type == PNG_COLOR_TYPE_RGB ||
|
(that->colour_type == PNG_COLOR_TYPE_RGB ||
|
||||||
that->colour_type == PNG_COLOR_TYPE_GRAY))
|
that->colour_type == PNG_COLOR_TYPE_GRAY))
|
||||||
{
|
{
|
||||||
const unsigned int max = (1U << that->bit_depth)-1;
|
unsigned int max = (1U << that->bit_depth)-1;
|
||||||
that->alpha = data.filler & max;
|
that->alpha = data.filler & max;
|
||||||
that->alphaf = ((double)that->alpha) / max;
|
that->alphaf = ((double)that->alpha) / max;
|
||||||
that->alphae = 0;
|
that->alphae = 0;
|
||||||
|
@ -8884,7 +8884,7 @@ image_transform_png_set_shift_set(const image_transform *this,
|
||||||
* field is randomized independently. This acts as a check that
|
* field is randomized independently. This acts as a check that
|
||||||
* libpng does use the correct field.
|
* libpng does use the correct field.
|
||||||
*/
|
*/
|
||||||
const unsigned int depth = that->this.bit_depth;
|
unsigned int depth = that->this.bit_depth;
|
||||||
|
|
||||||
data.red = (png_byte)/*SAFE*/(random_mod(depth)+1);
|
data.red = (png_byte)/*SAFE*/(random_mod(depth)+1);
|
||||||
data.green = (png_byte)/*SAFE*/(random_mod(depth)+1);
|
data.green = (png_byte)/*SAFE*/(random_mod(depth)+1);
|
||||||
|
@ -9299,12 +9299,12 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
|
||||||
int mode = dp->do_background - ALPHA_MODE_OFFSET;
|
int mode = dp->do_background - ALPHA_MODE_OFFSET;
|
||||||
|
|
||||||
/* The gamma value is the output gamma, and is in the standard,
|
/* The gamma value is the output gamma, and is in the standard,
|
||||||
* non-inverted, represenation. It provides a default for the PNG file
|
* non-inverted, representation. It provides a default for the PNG file
|
||||||
* gamma, but since the file has a gAMA chunk this does not matter.
|
* gamma, but since the file has a gAMA chunk this does not matter.
|
||||||
*/
|
*/
|
||||||
const double sg = dp->screen_gamma;
|
const double sg = dp->screen_gamma;
|
||||||
# ifndef PNG_FLOATING_POINT_SUPPORTED
|
# ifndef PNG_FLOATING_POINT_SUPPORTED
|
||||||
const png_fixed_point g = fix(sg);
|
png_fixed_point g = fix(sg);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
@ -9352,7 +9352,7 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
|
||||||
*/
|
*/
|
||||||
const double bg = dp->background_gamma;
|
const double bg = dp->background_gamma;
|
||||||
# ifndef PNG_FLOATING_POINT_SUPPORTED
|
# ifndef PNG_FLOATING_POINT_SUPPORTED
|
||||||
const png_fixed_point g = fix(bg);
|
png_fixed_point g = fix(bg);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
@ -9426,7 +9426,7 @@ static void
|
||||||
init_validate_info(validate_info *vi, gamma_display *dp, png_const_structp pp,
|
init_validate_info(validate_info *vi, gamma_display *dp, png_const_structp pp,
|
||||||
int in_depth, int out_depth)
|
int in_depth, int out_depth)
|
||||||
{
|
{
|
||||||
const unsigned int outmax = (1U<<out_depth)-1;
|
unsigned int outmax = (1U<<out_depth)-1;
|
||||||
|
|
||||||
vi->pp = pp;
|
vi->pp = pp;
|
||||||
vi->dp = dp;
|
vi->dp = dp;
|
||||||
|
@ -9588,14 +9588,14 @@ gamma_component_compose(int do_background, double input_sample, double alpha,
|
||||||
/* This API returns the encoded *input* component, in the range 0..1 */
|
/* This API returns the encoded *input* component, in the range 0..1 */
|
||||||
static double
|
static double
|
||||||
gamma_component_validate(const char *name, const validate_info *vi,
|
gamma_component_validate(const char *name, const validate_info *vi,
|
||||||
const unsigned int id, const unsigned int od,
|
unsigned int id, unsigned int od,
|
||||||
const double alpha /* <0 for the alpha channel itself */,
|
const double alpha /* <0 for the alpha channel itself */,
|
||||||
const double background /* component background value */)
|
const double background /* component background value */)
|
||||||
{
|
{
|
||||||
const unsigned int isbit = id >> vi->isbit_shift;
|
unsigned int isbit = id >> vi->isbit_shift;
|
||||||
const unsigned int sbit_max = vi->sbit_max;
|
unsigned int sbit_max = vi->sbit_max;
|
||||||
const unsigned int outmax = vi->outmax;
|
unsigned int outmax = vi->outmax;
|
||||||
const int do_background = vi->do_background;
|
int do_background = vi->do_background;
|
||||||
|
|
||||||
double i;
|
double i;
|
||||||
|
|
||||||
|
@ -9746,7 +9746,7 @@ gamma_component_validate(const char *name, const validate_info *vi,
|
||||||
*
|
*
|
||||||
* pngvalid calculations:
|
* pngvalid calculations:
|
||||||
* input_sample: linear result; i linearized and composed, range 0..1
|
* input_sample: linear result; i linearized and composed, range 0..1
|
||||||
* encoded_sample: encoded result; input_sample scaled to ouput bit depth
|
* encoded_sample: encoded result; input_sample scaled to output bit depth
|
||||||
*
|
*
|
||||||
* libpng calculations:
|
* libpng calculations:
|
||||||
* output: linear result; od scaled to 0..1 and linearized
|
* output: linear result; od scaled to 0..1 and linearized
|
||||||
|
@ -10161,13 +10161,13 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||||
{
|
{
|
||||||
/* Get some constants derived from the input and output file formats: */
|
/* Get some constants derived from the input and output file formats: */
|
||||||
const png_store* const ps = dp->this.ps;
|
const png_store* const ps = dp->this.ps;
|
||||||
const png_byte in_ct = dp->this.colour_type;
|
png_byte in_ct = dp->this.colour_type;
|
||||||
const png_byte in_bd = dp->this.bit_depth;
|
png_byte in_bd = dp->this.bit_depth;
|
||||||
const png_uint_32 w = dp->this.w;
|
png_uint_32 w = dp->this.w;
|
||||||
const png_uint_32 h = dp->this.h;
|
png_uint_32 h = dp->this.h;
|
||||||
const size_t cbRow = dp->this.cbRow;
|
const size_t cbRow = dp->this.cbRow;
|
||||||
const png_byte out_ct = png_get_color_type(pp, pi);
|
png_byte out_ct = png_get_color_type(pp, pi);
|
||||||
const png_byte out_bd = png_get_bit_depth(pp, pi);
|
png_byte out_bd = png_get_bit_depth(pp, pi);
|
||||||
|
|
||||||
/* There are three sources of error, firstly the quantization in the
|
/* There are three sources of error, firstly the quantization in the
|
||||||
* file encoding, determined by sbit and/or the file depth, secondly
|
* file encoding, determined by sbit and/or the file depth, secondly
|
||||||
|
@ -10183,10 +10183,10 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||||
* Since the library must quantize the output to 8 or 16 bits there is
|
* Since the library must quantize the output to 8 or 16 bits there is
|
||||||
* a fundamental limit on the accuracy of the output of +/-.5 - this
|
* a fundamental limit on the accuracy of the output of +/-.5 - this
|
||||||
* quantization limit is included in addition to the other limits
|
* quantization limit is included in addition to the other limits
|
||||||
* specified by the paramaters to the API. (Effectively, add .5
|
* specified by the parameters to the API. (Effectively, add .5
|
||||||
* everywhere.)
|
* everywhere.)
|
||||||
*
|
*
|
||||||
* The behavior of the 'sbit' paramter is defined by section 12.5
|
* The behavior of the 'sbit' parameter is defined by section 12.5
|
||||||
* (sample depth scaling) of the PNG spec. That section forces the
|
* (sample depth scaling) of the PNG spec. That section forces the
|
||||||
* decoder to assume that the PNG values have been scaled if sBIT is
|
* decoder to assume that the PNG values have been scaled if sBIT is
|
||||||
* present:
|
* present:
|
||||||
|
@ -10208,11 +10208,11 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||||
* The basic tests below do not do this, however if 'use_input_precision'
|
* The basic tests below do not do this, however if 'use_input_precision'
|
||||||
* is set a subsequent test is performed above.
|
* is set a subsequent test is performed above.
|
||||||
*/
|
*/
|
||||||
const unsigned int samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
|
unsigned int samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
|
||||||
int processing;
|
int processing;
|
||||||
png_uint_32 y;
|
png_uint_32 y;
|
||||||
const store_palette_entry *in_palette = dp->this.palette;
|
const store_palette_entry *in_palette = dp->this.palette;
|
||||||
const int in_is_transparent = dp->this.is_transparent;
|
int in_is_transparent = dp->this.is_transparent;
|
||||||
int process_tRNS;
|
int process_tRNS;
|
||||||
int out_npalette = -1;
|
int out_npalette = -1;
|
||||||
int out_is_transparent = 0; /* Just refers to the palette case */
|
int out_is_transparent = 0; /* Just refers to the palette case */
|
||||||
|
@ -10260,9 +10260,9 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||||
double alpha = 1; /* serves as a flag value */
|
double alpha = 1; /* serves as a flag value */
|
||||||
|
|
||||||
/* Record the palette index for index images. */
|
/* Record the palette index for index images. */
|
||||||
const unsigned int in_index =
|
unsigned int in_index =
|
||||||
in_ct == 3 ? sample(std, 3, in_bd, x, 0, 0, 0) : 256;
|
in_ct == 3 ? sample(std, 3, in_bd, x, 0, 0, 0) : 256;
|
||||||
const unsigned int out_index =
|
unsigned int out_index =
|
||||||
out_ct == 3 ? sample(std, 3, out_bd, x, 0, 0, 0) : 256;
|
out_ct == 3 ? sample(std, 3, out_bd, x, 0, 0, 0) : 256;
|
||||||
|
|
||||||
/* Handle input alpha - png_set_background will cause the output
|
/* Handle input alpha - png_set_background will cause the output
|
||||||
|
@ -10271,7 +10271,7 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||||
if ((in_ct & PNG_COLOR_MASK_ALPHA) != 0 ||
|
if ((in_ct & PNG_COLOR_MASK_ALPHA) != 0 ||
|
||||||
(in_ct == 3 && in_is_transparent))
|
(in_ct == 3 && in_is_transparent))
|
||||||
{
|
{
|
||||||
const unsigned int input_alpha = in_ct == 3 ?
|
unsigned int input_alpha = in_ct == 3 ?
|
||||||
dp->this.palette[in_index].alpha :
|
dp->this.palette[in_index].alpha :
|
||||||
sample(std, in_ct, in_bd, x, samples_per_pixel, 0, 0);
|
sample(std, in_ct, in_bd, x, samples_per_pixel, 0, 0);
|
||||||
|
|
||||||
|
@ -10396,14 +10396,14 @@ gamma_end(png_structp ppIn, png_infop pi)
|
||||||
* maxpc: maximum percentage error (as a percentage)
|
* maxpc: maximum percentage error (as a percentage)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
gamma_test(png_modifier *pmIn, const png_byte colour_typeIn,
|
gamma_test(png_modifier *pmIn, png_byte colour_typeIn,
|
||||||
const png_byte bit_depthIn, const int palette_numberIn,
|
png_byte bit_depthIn, int palette_numberIn,
|
||||||
const int interlace_typeIn,
|
int interlace_typeIn,
|
||||||
const double file_gammaIn, const double screen_gammaIn,
|
const double file_gammaIn, const double screen_gammaIn,
|
||||||
const png_byte sbitIn, const int threshold_testIn,
|
png_byte sbitIn, int threshold_testIn,
|
||||||
const char *name,
|
const char *name,
|
||||||
const int use_input_precisionIn, const int scale16In,
|
int use_input_precisionIn, int scale16In,
|
||||||
const int expand16In, const int do_backgroundIn,
|
int expand16In, int do_backgroundIn,
|
||||||
const png_color_16 *bkgd_colorIn, double bkgd_gammaIn)
|
const png_color_16 *bkgd_colorIn, double bkgd_gammaIn)
|
||||||
{
|
{
|
||||||
gamma_display d;
|
gamma_display d;
|
||||||
|
@ -10607,11 +10607,11 @@ perform_gamma_threshold_tests(png_modifier *pm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gamma_transform_test(png_modifier *pm,
|
static void gamma_transform_test(png_modifier *pm,
|
||||||
const png_byte colour_type, const png_byte bit_depth,
|
png_byte colour_type, png_byte bit_depth,
|
||||||
const int palette_number,
|
int palette_number,
|
||||||
const int interlace_type, const double file_gamma,
|
int interlace_type, const double file_gamma,
|
||||||
const double screen_gamma, const png_byte sbit,
|
const double screen_gamma, png_byte sbit,
|
||||||
const int use_input_precision, const int scale16)
|
int use_input_precision, int scale16)
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
char name[64];
|
char name[64];
|
||||||
|
@ -10768,12 +10768,12 @@ static void perform_gamma_scale16_tests(png_modifier *pm)
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||||
static void gamma_composition_test(png_modifier *pm,
|
static void gamma_composition_test(png_modifier *pm,
|
||||||
const png_byte colour_type, const png_byte bit_depth,
|
png_byte colour_type, png_byte bit_depth,
|
||||||
const int palette_number,
|
int palette_number,
|
||||||
const int interlace_type, const double file_gamma,
|
int interlace_type, const double file_gamma,
|
||||||
const double screen_gamma,
|
const double screen_gamma,
|
||||||
const int use_input_precision, const int do_background,
|
int use_input_precision, int do_background,
|
||||||
const int expand_16)
|
int expand_16)
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
png_const_charp base;
|
png_const_charp base;
|
||||||
|
@ -11729,7 +11729,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
/* Some default values (set the behavior for 'make check' here).
|
/* Some default values (set the behavior for 'make check' here).
|
||||||
* These values simply control the maximum error permitted in the gamma
|
* These values simply control the maximum error permitted in the gamma
|
||||||
* transformations. The practial limits for human perception are described
|
* transformations. The practical limits for human perception are described
|
||||||
* below (the setting for maxpc16), however for 8 bit encodings it isn't
|
* below (the setting for maxpc16), however for 8 bit encodings it isn't
|
||||||
* possible to meet the accepted capabilities of human vision - i.e. 8 bit
|
* possible to meet the accepted capabilities of human vision - i.e. 8 bit
|
||||||
* images can never be good enough, regardless of encoding.
|
* images can never be good enough, regardless of encoding.
|
||||||
|
|
|
@ -60,7 +60,7 @@ read_png(FILE *fp)
|
||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
{
|
{
|
||||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||||
|
|
||||||
/* Failure to initialize these is harmless */
|
/* Failure to initialize these is harmless */
|
||||||
row = malloc(rowbytes);
|
row = malloc(rowbytes);
|
||||||
|
|
|
@ -108,7 +108,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
png_size_t index;
|
size_t index;
|
||||||
int state, failed = 0;
|
int state, failed = 0;
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||||
}
|
}
|
||||||
else if (PNG_FP_IS_POSITIVE(state) && !(test > 0))
|
else if (PNG_FP_IS_POSITIVE(state) && !(test > 0))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%g[%d] -> '%s' but postive value not so reported\n",
|
fprintf(stderr, "%g[%d] -> '%s' but positive value not so reported\n",
|
||||||
test, precision, buffer);
|
test, precision, buffer);
|
||||||
failed = 1;
|
failed = 1;
|
||||||
assert(!PNG_FP_IS_NEGATIVE(state));
|
assert(!PNG_FP_IS_NEGATIVE(state));
|
||||||
|
@ -329,10 +329,10 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
|
||||||
{
|
{
|
||||||
/* Test this character (ch) to ensure the parser does the correct thing.
|
/* Test this character (ch) to ensure the parser does the correct thing.
|
||||||
*/
|
*/
|
||||||
png_size_t index = 0;
|
size_t index = 0;
|
||||||
const char test = (char)ch;
|
const char test = (char)ch;
|
||||||
const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
||||||
const int character_accepted = (index == 1);
|
int character_accepted = (index == 1);
|
||||||
|
|
||||||
if (c.check_state != exponent && isdigit(ch) && ch != '0')
|
if (c.check_state != exponent && isdigit(ch) && ch != '0')
|
||||||
c.is_zero = 0;
|
c.is_zero = 0;
|
||||||
|
|
|
@ -65,7 +65,7 @@ typedef struct
|
||||||
} io_data;
|
} io_data;
|
||||||
|
|
||||||
static PNG_CALLBACK(void, read_and_copy,
|
static PNG_CALLBACK(void, read_and_copy,
|
||||||
(png_structp png_ptr, png_bytep buffer, png_size_t cb))
|
(png_structp png_ptr, png_bytep buffer, size_t cb))
|
||||||
{
|
{
|
||||||
io_data *io = (io_data*)png_get_io_ptr(png_ptr);
|
io_data *io = (io_data*)png_get_io_ptr(png_ptr);
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ static void read_by_row(png_structp png_ptr, png_infop info_ptr,
|
||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
{
|
{
|
||||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||||
|
|
||||||
row = voidcast(png_bytep,malloc(rowbytes));
|
row = voidcast(png_bytep,malloc(rowbytes));
|
||||||
display = voidcast(png_bytep,malloc(rowbytes));
|
display = voidcast(png_bytep,malloc(rowbytes));
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
|
|
||||||
FROM gcr.io/oss-fuzz-base/base-builder
|
FROM gcr.io/oss-fuzz-base/base-builder
|
||||||
MAINTAINER glennrp@gmail.com
|
MAINTAINER glennrp@gmail.com
|
||||||
RUN apt-get update && apt-get install -y make autoconf automake libtool zlib1g-dev
|
RUN apt-get update && \
|
||||||
|
apt-get install -y make autoconf automake libtool
|
||||||
|
|
||||||
|
RUN git clone --depth 1 https://github.com/madler/zlib.git
|
||||||
RUN git clone --depth 1 https://github.com/glennrp/libpng.git
|
RUN git clone --depth 1 https://github.com/glennrp/libpng.git
|
||||||
RUN (cd libpng; git log | head -1)
|
RUN cp libpng/contrib/oss-fuzz/build.sh $SRC
|
||||||
WORKDIR libpng
|
WORKDIR libpng
|
||||||
COPY build.sh $SRC/
|
|
||||||
|
|
|
@ -24,13 +24,13 @@ The files are
|
||||||
Filename or derived Copyright License
|
Filename or derived Copyright License
|
||||||
========================= ========== ================ ==========
|
========================= ========== ================ ==========
|
||||||
Dockerfile* derived 2017, Glenn R-P Apache 2.0
|
Dockerfile* derived 2017, Glenn R-P Apache 2.0
|
||||||
build.sh* derived 2017, Glenn R-P Apache 2.0
|
build.sh derived 2017, Glenn R-P Apache 2.0
|
||||||
libpng_read_fuzzer.cc derived 2017, Glenn R-P Chromium
|
libpng_read_fuzzer.cc derived 2017, Glenn R-P Chromium
|
||||||
libpng_read_fuzzer.options original 2015, Chrome Devs Chromium
|
libpng_read_fuzzer.options original 2015, Chrome Devs Chromium
|
||||||
png.dict original 2015, Chrome Devs Chromium
|
png.dict original 2015, Chrome Devs Chromium
|
||||||
README.txt (this file) original 2017, Glenn R-P libpng
|
README.txt (this file) original 2017, Glenn R-P libpng
|
||||||
|
|
||||||
* Dockerfile and build.sh are copies of the files used by oss-fuzz.
|
* Dockerfile is a copy of the file used by oss-fuzz. build.sh,
|
||||||
png.dict and libpng_read_fuzzer.* are the actual files used by oss-fuzz,
|
png.dict and libpng_read_fuzzer.* are the actual files used by oss-fuzz,
|
||||||
which retrieves them from the libpng repository at Github.
|
which retrieves them from the libpng repository at Github.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash -eu
|
#!/bin/bash -eu
|
||||||
# Copyright 2017 Glenn Randers-Pehrson
|
# Copyright 2017-2018 Glenn Randers-Pehrson
|
||||||
# Copyright 2016 Google Inc.
|
# Copyright 2016 Google Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -14,12 +14,13 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
# Last changed in libpng 1.6.33 [September 28, 2017]
|
# Last changed in libpng 1.6.35 [July 15, 2018]
|
||||||
#
|
#
|
||||||
# Revisions by Glenn Randers-Pehson, 2017:
|
# Revisions by Glenn Randers-Pehrson, 2017:
|
||||||
# 1. Build only the library, not the tools (changed "make -j$(nproc) all" to
|
# 1. Build only the library, not the tools (changed "make -j$(nproc) all" to
|
||||||
# "make -j$(nproc) libpng16.la").
|
# "make -j$(nproc) libpng16.la").
|
||||||
# 2. Disabled WARNING and WRITE options in pnglibconf.dfa.
|
# 2. Disabled WARNING and WRITE options in pnglibconf.dfa.
|
||||||
|
# 3. Build zlib alongside libpng
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Disable logging via library build configuration control.
|
# Disable logging via library build configuration control.
|
||||||
|
@ -30,9 +31,9 @@ cat scripts/pnglibconf.dfa | \
|
||||||
> scripts/pnglibconf.dfa.temp
|
> scripts/pnglibconf.dfa.temp
|
||||||
mv scripts/pnglibconf.dfa.temp scripts/pnglibconf.dfa
|
mv scripts/pnglibconf.dfa.temp scripts/pnglibconf.dfa
|
||||||
|
|
||||||
# build the library.
|
# build the libpng library.
|
||||||
autoreconf -f -i
|
autoreconf -f -i
|
||||||
./configure
|
./configure --with-libpng-prefix=OSS_FUZZ_
|
||||||
make -j$(nproc) clean
|
make -j$(nproc) clean
|
||||||
make -j$(nproc) libpng16.la
|
make -j$(nproc) libpng16.la
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
// libpng_read_fuzzer.cc
|
// libpng_read_fuzzer.cc
|
||||||
// Copyright 2017 Glenn Randers-Pehrson
|
// Copyright 2017-2018 Glenn Randers-Pehrson
|
||||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style license that may
|
// Use of this source code is governed by a BSD-style license that may
|
||||||
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
|
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
|
||||||
|
|
||||||
// Last changed in libpng 1.6.32 [August 24, 2017]
|
// Last changed in libpng 1.6.35 [July 15, 2018]
|
||||||
|
|
||||||
// The modifications in 2017 by Glenn Randers-Pehrson include
|
// The modifications in 2017 by Glenn Randers-Pehrson include
|
||||||
// 1. addition of a PNG_CLEANUP macro,
|
// 1. addition of a PNG_CLEANUP macro,
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
// 3. adding "#include <string.h>" which is needed on some platforms
|
// 3. adding "#include <string.h>" which is needed on some platforms
|
||||||
// to provide memcpy().
|
// to provide memcpy().
|
||||||
// 4. adding read_end_info() and creating an end_info structure.
|
// 4. adding read_end_info() and creating an end_info structure.
|
||||||
|
// 5. adding calls to png_set_*() transforms commonly used by browsers.
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -67,7 +68,7 @@ struct PngObjectHandler {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
|
void user_read_data(png_structp png_ptr, png_bytep data, size_t length) {
|
||||||
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
|
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
|
||||||
if (length > buf_state->bytes_left) {
|
if (length > buf_state->bytes_left) {
|
||||||
png_error(png_ptr, "read error");
|
png_error(png_ptr, "read error");
|
||||||
|
@ -136,9 +137,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
|
|
||||||
// Reading.
|
// Reading.
|
||||||
png_read_info(png_handler.png_ptr, png_handler.info_ptr);
|
png_read_info(png_handler.png_ptr, png_handler.info_ptr);
|
||||||
png_handler.row_ptr = png_malloc(
|
|
||||||
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
|
|
||||||
png_handler.info_ptr));
|
|
||||||
|
|
||||||
// reset error handler to put png_deleter into scope.
|
// reset error handler to put png_deleter into scope.
|
||||||
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
|
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
|
||||||
|
@ -163,8 +161,20 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set several transforms that browsers typically use:
|
||||||
|
png_set_gray_to_rgb(png_handler.png_ptr);
|
||||||
|
png_set_expand(png_handler.png_ptr);
|
||||||
|
png_set_packing(png_handler.png_ptr);
|
||||||
|
png_set_scale_16(png_handler.png_ptr);
|
||||||
|
png_set_tRNS_to_alpha(png_handler.png_ptr);
|
||||||
|
|
||||||
int passes = png_set_interlace_handling(png_handler.png_ptr);
|
int passes = png_set_interlace_handling(png_handler.png_ptr);
|
||||||
png_start_read_image(png_handler.png_ptr);
|
|
||||||
|
png_read_update_info(png_handler.png_ptr, png_handler.info_ptr);
|
||||||
|
|
||||||
|
png_handler.row_ptr = png_malloc(
|
||||||
|
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
|
||||||
|
png_handler.info_ptr));
|
||||||
|
|
||||||
for (int pass = 0; pass < passes; ++pass) {
|
for (int pass = 0; pass < passes; ++pass) {
|
||||||
for (png_uint_32 y = 0; y < height; ++y) {
|
for (png_uint_32 y = 0; y < height; ++y) {
|
||||||
|
|
|
@ -1,190 +0,0 @@
|
||||||
|
|
||||||
// libpng_read_fuzzer.cc
|
|
||||||
// Copyright 2017 Glenn Randers-Pehrson
|
|
||||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that may
|
|
||||||
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
|
|
||||||
|
|
||||||
// Last changed in libpng 1.6.33beta03 [September 27, 2017]
|
|
||||||
|
|
||||||
// The modifications in 2017 by Glenn Randers-Pehrson include
|
|
||||||
// 1. addition of a PNG_CLEANUP macro,
|
|
||||||
// 2. setting the option to ignore ADLER32 checksums,
|
|
||||||
// 3. adding "#include <string.h>" which is needed on some platforms
|
|
||||||
// to provide memcpy().
|
|
||||||
// 4. adding read_end_info() and creating an end_info structure.
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
|
||||||
#include "png.h"
|
|
||||||
|
|
||||||
struct BufState {
|
|
||||||
const uint8_t* data;
|
|
||||||
size_t bytes_left;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PngObjectHandler {
|
|
||||||
png_infop info_ptr = nullptr;
|
|
||||||
png_structp png_ptr = nullptr;
|
|
||||||
png_infop end_info_ptr = nullptr;
|
|
||||||
png_voidp row_ptr = nullptr;
|
|
||||||
BufState* buf_state = nullptr;
|
|
||||||
|
|
||||||
~PngObjectHandler() {
|
|
||||||
if (row_ptr)
|
|
||||||
png_free(png_ptr, row_ptr);
|
|
||||||
if (end_info_ptr)
|
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info_ptr);
|
|
||||||
else if (info_ptr)
|
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
|
||||||
else
|
|
||||||
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
|
|
||||||
delete buf_state;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
|
|
||||||
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
|
|
||||||
if (length > buf_state->bytes_left) {
|
|
||||||
png_error(png_ptr, "read error");
|
|
||||||
}
|
|
||||||
memcpy(data, buf_state->data, length);
|
|
||||||
buf_state->bytes_left -= length;
|
|
||||||
buf_state->data += length;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const int kPngHeaderSize = 8;
|
|
||||||
|
|
||||||
// Entry point for LibFuzzer.
|
|
||||||
// Roughly follows the libpng book example:
|
|
||||||
// http://www.libpng.org/pub/png/book/chapter13.html
|
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
||||||
if (size < kPngHeaderSize) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<unsigned char> v(data, data + size);
|
|
||||||
if (png_sig_cmp(v.data(), 0, kPngHeaderSize)) {
|
|
||||||
// not a PNG.
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
PngObjectHandler png_handler;
|
|
||||||
png_handler.png_ptr = nullptr;
|
|
||||||
png_handler.row_ptr = nullptr;
|
|
||||||
png_handler.info_ptr = nullptr;
|
|
||||||
png_handler.end_info_ptr = nullptr;
|
|
||||||
|
|
||||||
png_handler.png_ptr = png_create_read_struct
|
|
||||||
(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
|
||||||
if (!png_handler.png_ptr) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define PNG_CLEANUP \
|
|
||||||
if(png_handler.png_ptr) \
|
|
||||||
{ \
|
|
||||||
if (png_handler.row_ptr) \
|
|
||||||
png_free(png_handler.png_ptr, png_handler.row_ptr); \
|
|
||||||
if (png_handler.end_info_ptr) \
|
|
||||||
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr,\
|
|
||||||
&png_handler.end_info_ptr); \
|
|
||||||
else if (png_handler.info_ptr) \
|
|
||||||
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr,\
|
|
||||||
nullptr); \
|
|
||||||
else \
|
|
||||||
png_destroy_read_struct(&png_handler.png_ptr, nullptr, nullptr); \
|
|
||||||
png_handler.png_ptr = nullptr; \
|
|
||||||
png_handler.row_ptr = nullptr; \
|
|
||||||
png_handler.info_ptr = nullptr; \
|
|
||||||
png_handler.end_info_ptr = nullptr; \
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handler.info_ptr = png_create_info_struct(png_handler.png_ptr);
|
|
||||||
if (!png_handler.info_ptr) {
|
|
||||||
PNG_CLEANUP
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handler.end_info_ptr = png_create_info_struct(png_handler.png_ptr);
|
|
||||||
if (!png_handler.end_info_ptr) {
|
|
||||||
PNG_CLEANUP
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Treat benign errors as warnings */
|
|
||||||
png_set_benign_errors(png_handler.png_ptr, 1);
|
|
||||||
|
|
||||||
png_set_crc_action(png_handler.png_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
|
|
||||||
|
|
||||||
#ifdef PNG_IGNORE_ADLER32
|
|
||||||
png_set_option(png_handler.png_ptr, PNG_IGNORE_ADLER32, PNG_OPTION_ON);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Setting up reading from buffer.
|
|
||||||
png_handler.buf_state = new BufState();
|
|
||||||
png_handler.buf_state->data = data + kPngHeaderSize;
|
|
||||||
png_handler.buf_state->bytes_left = size - kPngHeaderSize;
|
|
||||||
png_set_read_fn(png_handler.png_ptr, png_handler.buf_state, user_read_data);
|
|
||||||
png_set_sig_bytes(png_handler.png_ptr, kPngHeaderSize);
|
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
|
|
||||||
PNG_CLEANUP
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reading.
|
|
||||||
png_read_info(png_handler.png_ptr, png_handler.info_ptr);
|
|
||||||
png_read_update_info(png_handler.png_ptr, png_handler.info_ptr);
|
|
||||||
png_handler.row_ptr = png_malloc(
|
|
||||||
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
|
|
||||||
png_handler.info_ptr));
|
|
||||||
|
|
||||||
// reset error handler to put png_deleter into scope.
|
|
||||||
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
|
|
||||||
PNG_CLEANUP
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_uint_32 width, height;
|
|
||||||
int bit_depth, color_type, interlace_type, compression_type;
|
|
||||||
int filter_type;
|
|
||||||
|
|
||||||
if (!png_get_IHDR(png_handler.png_ptr, png_handler.info_ptr, &width,
|
|
||||||
&height, &bit_depth, &color_type, &interlace_type,
|
|
||||||
&compression_type, &filter_type)) {
|
|
||||||
PNG_CLEANUP
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is going to be too slow.
|
|
||||||
if (width && height > 100000000 / width) {
|
|
||||||
PNG_CLEANUP
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int passes = png_set_interlace_handling(png_handler.png_ptr);
|
|
||||||
png_start_read_image(png_handler.png_ptr);
|
|
||||||
|
|
||||||
/* To do: prevent the optimizer from removing this code entirely */
|
|
||||||
for (int pass = 0; pass < passes; ++pass) {
|
|
||||||
for (png_uint_32 y = 0; y < height; ++y) {
|
|
||||||
png_read_row(png_handler.png_ptr,
|
|
||||||
static_cast<png_bytep>(png_handler.row_ptr), nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
png_read_end(png_handler.png_ptr, png_handler.end_info_ptr);
|
|
||||||
|
|
||||||
PNG_CLEANUP
|
|
||||||
|
|
||||||
/* TO do: exercise the progressive reader here */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
pnm2png / png2pnm --- conversion from PBM/PGM/PPM-file to PNG-file
|
||||||
|
copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||||
|
|
||||||
|
version 1.0 - 1999.10.15 - First version.
|
||||||
|
1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
|
||||||
|
1.2 - 2017.04.22 - Add buffer-size check
|
||||||
|
1.3 - 2017.08.24 - Fix potential overflow in buffer-size check
|
||||||
|
(Glenn Randers-Pehrson)
|
||||||
|
1.4 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
|
||||||
|
1.5 - 2018.08.05 - Fix buffer overflow in tokenizer (Cosmin Truta)
|
||||||
|
1.6 - 2018.08.05 - Improve portability and fix style (Cosmin Truta)
|
||||||
|
1.7 - 2019.01.22 - Change license to MIT (Willem van Schaik)
|
|
@ -0,0 +1,24 @@
|
||||||
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
cmake_policy(VERSION 3.1)
|
||||||
|
|
||||||
|
project(PNGMINUS C)
|
||||||
|
|
||||||
|
option(PNGMINUS_USE_STATIC_LIBRARIES "Use the static library builds" ON)
|
||||||
|
|
||||||
|
# libpng
|
||||||
|
add_subdirectory(../.. libpng)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/libpng)
|
||||||
|
if(PNGMINUS_USE_STATIC_LIBRARIES)
|
||||||
|
set(PNGMINUS_PNG_LIBRARY png_static)
|
||||||
|
else()
|
||||||
|
set(PNGMINUS_PNG_LIBRARY png)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# png2pnm
|
||||||
|
add_executable(png2pnm png2pnm.c)
|
||||||
|
target_link_libraries(png2pnm ${PNGMINUS_PNG_LIBRARY})
|
||||||
|
|
||||||
|
# pnm2png
|
||||||
|
add_executable(pnm2png pnm2png.c)
|
||||||
|
target_link_libraries(pnm2png ${PNGMINUS_PNG_LIBRARY})
|
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
pnm2png / png2pnm --- conversion from PBM/PGM/PPM-file to PNG-file
|
||||||
|
|
||||||
|
copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
The software is provided "as is", without warranty of any kind, express or
|
||||||
|
implied, including but not limited to the warranties of merchantability,
|
||||||
|
fitness for a particular purpose and noninfringement. In no event shall the
|
||||||
|
authors or copyight holders be liable for any claim, damages or other
|
||||||
|
liability, whether in an action of contract, tort or otherwise, arising from,
|
||||||
|
out of or in connection with the software or the use or other dealings in the
|
||||||
|
software.
|
|
@ -0,0 +1,62 @@
|
||||||
|
# Makefile for PngMinus (png2pnm and pnm2png)
|
||||||
|
# Linux / Unix
|
||||||
|
|
||||||
|
#CC = cc
|
||||||
|
CC = gcc
|
||||||
|
LD = $(CC)
|
||||||
|
|
||||||
|
RM = rm -f
|
||||||
|
|
||||||
|
PNGINC = -I../..
|
||||||
|
PNGLIB_SHARED = -L../.. -lpng
|
||||||
|
PNGLIB_STATIC = ../../libpng.a
|
||||||
|
|
||||||
|
# Uncomment the following if you have a custom zlib build at ../../../zlib
|
||||||
|
#ZINC = -I../../../zlib
|
||||||
|
#ZLIB_SHARED = -L../../../zlib -lz
|
||||||
|
#ZLIB_STATIC = ../../../zlib/libz.a
|
||||||
|
|
||||||
|
# Use the system zlib otherwise
|
||||||
|
ZLIB_SHARED = -lz
|
||||||
|
ZLIB_STATIC = -lz
|
||||||
|
|
||||||
|
CPPFLAGS = $(PNGINC) $(ZINC)
|
||||||
|
CFLAGS =
|
||||||
|
LDFLAGS =
|
||||||
|
LIBS_SHARED = $(PNGLIB_SHARED) $(ZLIB_SHARED)
|
||||||
|
LIBS_STATIC = $(PNGLIB_STATIC) $(ZLIB_STATIC)
|
||||||
|
|
||||||
|
EXEEXT =
|
||||||
|
#EXEEXT = .exe
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
|
||||||
|
all: png2pnm$(EXEEXT) pnm2png$(EXEEXT) png2pnm-static$(EXEEXT) pnm2png-static$(EXEEXT)
|
||||||
|
|
||||||
|
png2pnm.o: png2pnm.c
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm.c
|
||||||
|
|
||||||
|
pnm2png.o: pnm2png.c
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png.c
|
||||||
|
|
||||||
|
png2pnm$(EXEEXT): png2pnm.o
|
||||||
|
$(LD) $(LDFLAGS) -o png2pnm$(EXEEXT) png2pnm.o $(LIBS_SHARED) -lm
|
||||||
|
|
||||||
|
pnm2png$(EXEEXT): pnm2png.o
|
||||||
|
$(LD) $(LDFLAGS) -o pnm2png$(EXEEXT) pnm2png.o $(LIBS_SHARED) -lm
|
||||||
|
|
||||||
|
png2pnm-static$(EXEEXT): png2pnm.o
|
||||||
|
$(LD) $(LDFLAGS) -o png2pnm-static$(EXEEXT) png2pnm.o $(LIBS_STATIC) -lm
|
||||||
|
|
||||||
|
pnm2png-static$(EXEEXT): pnm2png.o
|
||||||
|
$(LD) $(LDFLAGS) -o pnm2png-static$(EXEEXT) pnm2png.o $(LIBS_STATIC) -lm
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) png2pnm.o
|
||||||
|
$(RM) pnm2png.o
|
||||||
|
$(RM) png2pnm$(EXEEXT)
|
||||||
|
$(RM) pnm2png$(EXEEXT)
|
||||||
|
$(RM) png2pnm-static$(EXEEXT)
|
||||||
|
$(RM) pnm2png-static$(EXEEXT)
|
||||||
|
|
||||||
|
# End of makefile for png2pnm / pnm2png
|
|
@ -1,26 +1,16 @@
|
||||||
PngMinus
|
PngMinus
|
||||||
--------
|
--------
|
||||||
(copyright Willem van Schaik, 1999)
|
(copyright Willem van Schaik, 1999-2019)
|
||||||
|
|
||||||
|
|
||||||
License
|
|
||||||
-------
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute this software and
|
|
||||||
its documentation for any purpose and without fee is hereby granted,
|
|
||||||
provided that the above copyright notice appear in all copies and
|
|
||||||
that both that copyright notice and this permission notice appear in
|
|
||||||
supporting documentation. This software is provided "as is" without
|
|
||||||
express or implied warranty.
|
|
||||||
|
|
||||||
|
|
||||||
Some history
|
Some history
|
||||||
------------
|
------------
|
||||||
Soon after the creation of PNG in 1995, the need was felt for a set of
|
Soon after the creation of PNG in 1995, the need was felt for a set of
|
||||||
pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I
|
pnmtopng / pngtopnm utilities. Independently Alexander Lehmann and I
|
||||||
(Willem van Schaik) started such a project. Luckily we discovered this
|
(Willem van Schaik) started such a project. Luckily we discovered this
|
||||||
and merged the two together into pnmtopng.tar.gz, which is available
|
and merged the two, which later became part of NetPBM, available from
|
||||||
from a/o ftp://ftp.simplesystems.org/pub/libpng/png/.
|
SourceForge.
|
||||||
|
|
||||||
These two utilities have many, many options and make use of most of the
|
These two utilities have many, many options and make use of most of the
|
||||||
features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes
|
features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes
|
||||||
|
@ -35,8 +25,8 @@ makes the whole setup a bit bulky. But that's unavoidable given the many
|
||||||
features of pnmtopng.
|
features of pnmtopng.
|
||||||
|
|
||||||
|
|
||||||
What now
|
What now (1999)
|
||||||
--------
|
---------------
|
||||||
At this moment libpng is in a very stable state and can do much of the
|
At this moment libpng is in a very stable state and can do much of the
|
||||||
work done in pnmtopng. Also, pnmtopng needs to be upgraded to the new
|
work done in pnmtopng. Also, pnmtopng needs to be upgraded to the new
|
||||||
interface of libpng. Hence, it is time for a rewrite from the ground up
|
interface of libpng. Hence, it is time for a rewrite from the ground up
|
||||||
|
@ -49,8 +39,8 @@ a small prototype that contains only the basic functionality. It doesn't
|
||||||
have any of the options to read or write special chunks and it will do
|
have any of the options to read or write special chunks and it will do
|
||||||
no gamma correction. But this makes it also a simple program that is
|
no gamma correction. But this makes it also a simple program that is
|
||||||
quite easy to understand and can serve well as a template for other
|
quite easy to understand and can serve well as a template for other
|
||||||
software developments. (By now there are of course a couple of programs,
|
software developments. By now there are of course a couple of programs,
|
||||||
like Greg Roelofs' rpng/wpng, that can be used just as good.)
|
like Greg Roelofs' rpng/wpng, that can be used just as good.
|
||||||
|
|
||||||
|
|
||||||
Can and can not
|
Can and can not
|
||||||
|
@ -60,7 +50,8 @@ PngMinus. Because I started this development in good-old Turbo-C, I
|
||||||
avoided the use the netpbm library, which requires DOS extenders. Again,
|
avoided the use the netpbm library, which requires DOS extenders. Again,
|
||||||
another reason to call it PngMinus (minus netpbm :-). So, part of the
|
another reason to call it PngMinus (minus netpbm :-). So, part of the
|
||||||
program are some elementary routines to read / write pgm- and ppm-files.
|
program are some elementary routines to read / write pgm- and ppm-files.
|
||||||
It does not read b&w pbm-files.
|
It does not handle B&W pbm-files, but instead you could do pgm with bit-
|
||||||
|
depth 1.
|
||||||
|
|
||||||
The downside of this approach is that you can not use them on images
|
The downside of this approach is that you can not use them on images
|
||||||
that require blocks of memory bigger than 64k (the DOS version). For
|
that require blocks of memory bigger than 64k (the DOS version). For
|
||||||
|
@ -96,58 +87,34 @@ To list the options type "png2pnm -h" or "pnm2png -h".
|
||||||
|
|
||||||
Just like Scandinavian furniture
|
Just like Scandinavian furniture
|
||||||
--------------------------------
|
--------------------------------
|
||||||
You have to put it together yourself. I did test the software under
|
You have to put it together yourself. I developed the software on MS-DOS
|
||||||
MS-DOS with Turbo-C 3.0 and under RedHat Linux 4.2 with gcc. In both
|
with Turbo-C 3.0 and RedHat Linux 4.2 with gcc. In both cases I used
|
||||||
cases I used libpng-1.0.4 and zlib-1.1.3. Later versions should be OK,
|
libpng-1.0.4 and zlib-1.1.3. By now (2019) it is twenty years later and
|
||||||
however some older libpng versions have a bug in pngmem.c when using
|
more current versions are OK.
|
||||||
Turbo-C 3.0 (see below).
|
|
||||||
|
|
||||||
You can build it using one of the two makefiles (make -f makefile.###)
|
The makefile assumes that the libpng libraries can be found in ../.. and
|
||||||
or use the batch/script files pngminus.bat / pngminus.sh. This assumes
|
libz in ../../../zlib. But you can change this to for example ../libpng
|
||||||
that you have built the libraries in ../libpng and ../zlib. Using Linux,
|
and ../zlib. The makefile creates two versions of each program, one with
|
||||||
make sure that you have built libpng with makefile.std and not
|
static library support and the other using shared libraries.
|
||||||
makefile.linux (also called .lnx in earlier versions of libpng). The
|
|
||||||
latter creates a .so shared-library, while the PngMinus makefile assumes
|
|
||||||
a normal .a static library.
|
|
||||||
|
|
||||||
If you create a ../pngsuite directory and then store the basn####.png
|
If you create a ../pngsuite directory and then store the basn####.png
|
||||||
files from PngSuite (http://www.schaik.com/pngsuite/) in there, you can
|
files from PngSuite (http://www.schaik.com/pngsuite/) in there, you can
|
||||||
test in one go the proper functioning of PngMinus, see png2pnm.bat and
|
test the proper functioning of PngMinus by running pngminus.sh.
|
||||||
pnm2png.bat (or the .sh versions).
|
|
||||||
|
|
||||||
|
|
||||||
Warranty
|
Warranty
|
||||||
-------
|
-------
|
||||||
Please, remember that this was just a small experiment to learn a few
|
Please, remember that this was just a small experiment to learn a few
|
||||||
things. It will have many unforeseen features <vbg>. Who said bugs? Use
|
things. It will have many unforeseen features <vbg> ... who said bugs? Use
|
||||||
it when you are in need for something simple or when you want to start
|
it when you are in need for something simple or when you want a starting
|
||||||
developing your own stuff.
|
point for developing your own stuff.
|
||||||
|
|
||||||
|
|
||||||
The Turbo bug
|
|
||||||
-------------
|
|
||||||
** pngmem.old
|
|
||||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
|
||||||
hptr += 16L;
|
|
||||||
** pngmem.c
|
|
||||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
|
||||||
hptr = hptr + 16L;
|
|
||||||
**
|
|
||||||
|
|
||||||
** pngmem.old
|
|
||||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
|
||||||
hptr += (png_uint_32)65536L;
|
|
||||||
** pngmem.c
|
|
||||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
|
||||||
hptr = hptr + 65536L;
|
|
||||||
**
|
|
||||||
|
|
||||||
|
|
||||||
The end
|
The end
|
||||||
-------
|
-------
|
||||||
Willem van Schaik
|
Willem van Schaik
|
||||||
mailto:willem at schaik.com
|
mailto:willem at schaik dot com
|
||||||
http://www.schaik.com/png/
|
http://www.schaik.com/png/
|
||||||
-------
|
|
||||||
Oct 1999
|
Oct 1999, Jan 2019
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
|
||||||
# Linux / Unix
|
|
||||||
|
|
||||||
#CC=cc
|
|
||||||
CC=gcc
|
|
||||||
LD=$(CC)
|
|
||||||
|
|
||||||
RM=rm -f
|
|
||||||
|
|
||||||
#PNGPATH = /usr/local
|
|
||||||
#PNGINC = -I$(PNGPATH)/include/libpng16
|
|
||||||
#PNGLIB = -L$(PNGPATH)/lib -lpng16
|
|
||||||
#PNGLIBS = $(PNGPATH)/lib/libpng16.a
|
|
||||||
PNGINC = -I../..
|
|
||||||
PNGLIB = -L../.. -lpng
|
|
||||||
PNGLIBS = ../../libpng.a
|
|
||||||
|
|
||||||
#ZPATH = /usr/local
|
|
||||||
#ZINC = -I$(ZPATH)/include
|
|
||||||
#ZLIB = -L$(ZPATH)/lib -lz
|
|
||||||
#ZLIBS = $(ZPATH)/lib/libz.a
|
|
||||||
ZINC = -I../../../zlib
|
|
||||||
ZLIB = -L../../../zlib -lz
|
|
||||||
ZLIBS = ../../../zlib/libz.a
|
|
||||||
|
|
||||||
CPPFLAGS=$(PNGINC) $(ZINC)
|
|
||||||
CFLAGS=
|
|
||||||
LDLIBS=$(PNGLIB) $(ZLIB)
|
|
||||||
LDLIBSS=$(PNGLIBS) $(ZLIBS)
|
|
||||||
C=.c
|
|
||||||
O=.o
|
|
||||||
L=.a
|
|
||||||
E=
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
|
|
||||||
#all: png2pnm$(E) pnm2png$(E)
|
|
||||||
all: png2pnm$(E) pnm2png$(E) png2pnm-static$(E) pnm2png-static$(E)
|
|
||||||
|
|
||||||
png2pnm$(O): png2pnm$(C)
|
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
|
|
||||||
|
|
||||||
png2pnm$(E): png2pnm$(O)
|
|
||||||
$(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
|
|
||||||
|
|
||||||
png2pnm-static$(E): png2pnm$(O)
|
|
||||||
$(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
|
|
||||||
|
|
||||||
pnm2png$(O): pnm2png$(C)
|
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
|
|
||||||
|
|
||||||
pnm2png$(E): pnm2png$(O)
|
|
||||||
$(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
|
|
||||||
|
|
||||||
pnm2png-static$(E): pnm2png$(O)
|
|
||||||
$(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) png2pnm$(O)
|
|
||||||
$(RM) pnm2png$(O)
|
|
||||||
$(RM) png2pnm$(E)
|
|
||||||
$(RM) pnm2png$(E)
|
|
||||||
$(RM) png2pnm-static$(E)
|
|
||||||
$(RM) pnm2png-static$(E)
|
|
||||||
|
|
||||||
# End of makefile for png2pnm / pnm2png
|
|
|
@ -1,38 +0,0 @@
|
||||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
|
||||||
# TurboC++ 3.0
|
|
||||||
|
|
||||||
CC=tcc -Ic:\tc3\inc
|
|
||||||
LD=tcc -Lc:\tc3\lib
|
|
||||||
LB=tlib
|
|
||||||
RM=del
|
|
||||||
CP=copy
|
|
||||||
MODEL=l
|
|
||||||
CPPFLAGS=-I..\libpng -I..\zlib
|
|
||||||
CFLAGS=-O -m$(MODEL)
|
|
||||||
LDFLAGS=-m$(MODEL) -L..\libpng -L..\zlib
|
|
||||||
C=.c
|
|
||||||
O=.obj
|
|
||||||
L=.lib
|
|
||||||
E=.exe
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
|
|
||||||
all: png2pnm$(E) pnm2png$(E)
|
|
||||||
|
|
||||||
png2pnm$(O): png2pnm$(C)
|
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
|
|
||||||
|
|
||||||
png2pnm$(E): png2pnm$(O)
|
|
||||||
$(LD) $(LDFLAGS) png2pnm$(O) libpng$(L) zlib$(L)
|
|
||||||
|
|
||||||
pnm2png$(O): pnm2png$(C)
|
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
|
|
||||||
|
|
||||||
pnm2png$(E): pnm2png$(O)
|
|
||||||
$(LD) $(LDFLAGS) pnm2png$(O) libpng$(L) zlib$(L)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) *$(O)
|
|
||||||
$(RM) *$(E)
|
|
||||||
|
|
||||||
# End of makefile for png2pnm / pnm2png
|
|
|
@ -7,7 +7,7 @@ png2pnm.exe -noraw ..\pngsuite\basn0g16.png basn0g16.pgm
|
||||||
REM -- full-color
|
REM -- full-color
|
||||||
png2pnm.exe -noraw ..\pngsuite\basn2c08.png basn2c08.ppm
|
png2pnm.exe -noraw ..\pngsuite\basn2c08.png basn2c08.ppm
|
||||||
png2pnm.exe -noraw ..\pngsuite\basn2c16.png basn2c16.ppm
|
png2pnm.exe -noraw ..\pngsuite\basn2c16.png basn2c16.ppm
|
||||||
REM -- palletted
|
REM -- paletted
|
||||||
png2pnm.exe -noraw ..\pngsuite\basn3p01.png basn3p01.ppm
|
png2pnm.exe -noraw ..\pngsuite\basn3p01.png basn3p01.ppm
|
||||||
png2pnm.exe -noraw ..\pngsuite\basn3p02.png basn3p02.ppm
|
png2pnm.exe -noraw ..\pngsuite\basn3p02.png basn3p02.ppm
|
||||||
png2pnm.exe -noraw ..\pngsuite\basn3p04.png basn3p04.ppm
|
png2pnm.exe -noraw ..\pngsuite\basn3p04.png basn3p04.ppm
|
||||||
|
@ -27,7 +27,7 @@ png2pnm.exe -raw ..\pngsuite\basn0g16.png rawn0g16.pgm
|
||||||
REM -- full-color
|
REM -- full-color
|
||||||
png2pnm.exe -raw ..\pngsuite\basn2c08.png rawn2c08.ppm
|
png2pnm.exe -raw ..\pngsuite\basn2c08.png rawn2c08.ppm
|
||||||
png2pnm.exe -raw ..\pngsuite\basn2c16.png rawn2c16.ppm
|
png2pnm.exe -raw ..\pngsuite\basn2c16.png rawn2c16.ppm
|
||||||
REM -- palletted
|
REM -- paletted
|
||||||
png2pnm.exe -raw ..\pngsuite\basn3p01.png rawn3p01.ppm
|
png2pnm.exe -raw ..\pngsuite\basn3p01.png rawn3p01.ppm
|
||||||
png2pnm.exe -raw ..\pngsuite\basn3p02.png rawn3p02.ppm
|
png2pnm.exe -raw ..\pngsuite\basn3p02.png rawn3p02.ppm
|
||||||
png2pnm.exe -raw ..\pngsuite\basn3p04.png rawn3p04.ppm
|
png2pnm.exe -raw ..\pngsuite\basn3p04.png rawn3p04.ppm
|
||||||
|
|
|
@ -1,28 +1,14 @@
|
||||||
/*
|
/*
|
||||||
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
|
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
|
||||||
* copyright (C) 1999,2017 by Willem van Schaik <willem at schaik.com>
|
* copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||||
*
|
*
|
||||||
* version 1.0 - 1999.10.15 - First version.
|
* This software is released under the MIT license. For conditions of
|
||||||
* 1.1 - 2017.04.22 - Add buffer-size check (Glenn Randers-Pehrson)
|
* distribution and use, see the LICENSE file part of this package.
|
||||||
* 1.2 - 2017.08.24 - Fix potential overflow in buffer-size check
|
|
||||||
* (Glenn Randers-Pehrson)
|
|
||||||
* 1.3 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software and
|
|
||||||
* its documentation for any purpose and without fee is hereby granted,
|
|
||||||
* provided that the above copyright notice appear in all copies and
|
|
||||||
* that both that copyright notice and this permission notice appear in
|
|
||||||
* supporting documentation. This software is provided "as is" without
|
|
||||||
* express or implied warranty.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef __TURBOC__
|
|
||||||
#include <mem.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
#ifndef BOOL
|
#ifndef BOOL
|
||||||
#define BOOL unsigned char
|
#define BOOL unsigned char
|
||||||
|
@ -34,39 +20,19 @@
|
||||||
#define FALSE (BOOL) 0
|
#define FALSE (BOOL) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
/* make png2pnm verbose so we can find problems (needs to be before png.h) */
|
||||||
#define STDIN 0
|
|
||||||
#define STDOUT 1
|
|
||||||
#define STDERR 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* to make png2pnm verbose so we can find problems (needs to be before png.h) */
|
|
||||||
#ifndef PNG_DEBUG
|
#ifndef PNG_DEBUG
|
||||||
#define PNG_DEBUG 0
|
#define PNG_DEBUG 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
|
|
||||||
#ifndef png_jmpbuf
|
|
||||||
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PNGMINUS_UNUSED
|
|
||||||
/* Unused formal parameter warnings are silenced using the following macro
|
|
||||||
* which is expected to have no bad effects on performance (optimizing
|
|
||||||
* compilers will probably remove it entirely).
|
|
||||||
*/
|
|
||||||
# define PNGMINUS_UNUSED(param) (void)param
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* function prototypes */
|
/* function prototypes */
|
||||||
|
|
||||||
int main (int argc, char *argv[]);
|
int main (int argc, char *argv[]);
|
||||||
void usage ();
|
void usage ();
|
||||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw,
|
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
BOOL alpha);
|
BOOL raw, BOOL alpha);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main
|
* main
|
||||||
|
@ -144,16 +110,12 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
} /* end for */
|
} /* end for */
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||||
/* set stdin/stdout if required to binary */
|
/* set stdin/stdout if required to binary */
|
||||||
if (fp_rd == stdin)
|
if (fp_rd == stdin)
|
||||||
{
|
setmode (fileno (stdin), O_BINARY);
|
||||||
setmode (STDIN, O_BINARY);
|
|
||||||
}
|
|
||||||
if ((raw) && (fp_wr == stdout))
|
if ((raw) && (fp_wr == stdout))
|
||||||
{
|
setmode (fileno (stdout), O_BINARY);
|
||||||
setmode (STDOUT, O_BINARY);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* call the conversion program itself */
|
/* call the conversion program itself */
|
||||||
|
@ -183,11 +145,6 @@ void usage()
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNG2PNM\n");
|
fprintf (stderr, "PNG2PNM\n");
|
||||||
fprintf (stderr, " by Willem van Schaik, 1999\n");
|
fprintf (stderr, " by Willem van Schaik, 1999\n");
|
||||||
#ifdef __TURBOC__
|
|
||||||
fprintf (stderr, " for Turbo-C and Borland-C compilers\n");
|
|
||||||
#else
|
|
||||||
fprintf (stderr, " for Linux (and Unix) compilers\n");
|
|
||||||
#endif
|
|
||||||
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
|
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
|
||||||
fprintf (stderr, " or: ... | png2pnm [options]\n");
|
fprintf (stderr, " or: ... | png2pnm [options]\n");
|
||||||
fprintf (stderr, "Options:\n");
|
fprintf (stderr, "Options:\n");
|
||||||
|
@ -204,7 +161,7 @@ void usage()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
volatile BOOL raw, BOOL alpha)
|
BOOL raw, BOOL alpha)
|
||||||
{
|
{
|
||||||
png_struct *png_ptr = NULL;
|
png_struct *png_ptr = NULL;
|
||||||
png_info *info_ptr = NULL;
|
png_info *info_ptr = NULL;
|
||||||
|
@ -231,7 +188,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ret = png_sig_cmp (buf, 0, 8);
|
ret = png_sig_cmp (buf, 0, 8);
|
||||||
if (ret)
|
if (ret != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* create png and info structures */
|
/* create png and info structures */
|
||||||
|
@ -262,8 +219,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
png_read_info (png_ptr, info_ptr);
|
png_read_info (png_ptr, info_ptr);
|
||||||
|
|
||||||
/* get size and bit-depth of the PNG-image */
|
/* get size and bit-depth of the PNG-image */
|
||||||
png_get_IHDR (png_ptr, info_ptr,
|
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||||
&width, &height, &bit_depth, &color_type,
|
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
/* set-up the transformations */
|
/* set-up the transformations */
|
||||||
|
@ -304,8 +260,8 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
{
|
{
|
||||||
raw = FALSE;
|
raw = FALSE;
|
||||||
#ifdef __TURBOC__
|
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||||
pnm_file->flags &= ~((unsigned) _F_BIN);
|
setmode (fileno (pnm_file), O_BINARY);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,25 +289,25 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||||
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
|
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
|
||||||
|
|
||||||
if ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes))
|
if ((row_bytes == 0) ||
|
||||||
|
((size_t) height > (size_t) (-1) / (size_t) row_bytes))
|
||||||
{
|
{
|
||||||
/* too big */
|
/* too big */
|
||||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ((png_pixels = (png_byte *)
|
if ((png_pixels = (png_byte *)
|
||||||
malloc ((size_t)row_bytes * (size_t)height * sizeof (png_byte))) == NULL)
|
malloc ((size_t) row_bytes * (size_t) height)) == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((row_pointers = (png_byte **)
|
if ((row_pointers = (png_byte **)
|
||||||
malloc ((size_t)height * sizeof (png_bytep))) == NULL)
|
malloc ((size_t) height * sizeof (png_byte *))) == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
png_pixels = NULL;
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +322,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
png_read_end (png_ptr, info_ptr);
|
png_read_end (png_ptr, info_ptr);
|
||||||
|
|
||||||
/* clean up after the read, and free any memory allocated - REQUIRED */
|
/* clean up after the read, and free any memory allocated - REQUIRED */
|
||||||
png_destroy_read_struct (&png_ptr, &info_ptr, (png_infopp) NULL);
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
|
|
||||||
/* write header of PNM file */
|
/* write header of PNM file */
|
||||||
|
|
||||||
|
@ -406,15 +362,22 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
for (i = 0; i < (channels - alpha_present); i++)
|
for (i = 0; i < (channels - alpha_present); i++)
|
||||||
{
|
{
|
||||||
if (raw)
|
if (raw)
|
||||||
|
{
|
||||||
fputc ((int) *pix_ptr++, pnm_file);
|
fputc ((int) *pix_ptr++, pnm_file);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (bit_depth == 16){
|
{
|
||||||
|
if (bit_depth == 16)
|
||||||
|
{
|
||||||
dep_16 = (long) *pix_ptr++;
|
dep_16 = (long) *pix_ptr++;
|
||||||
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fprintf (pnm_file, "%ld ", (long) *pix_ptr++);
|
fprintf (pnm_file, "%ld ", (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (alpha_present)
|
if (alpha_present)
|
||||||
{
|
{
|
||||||
if (!alpha)
|
if (!alpha)
|
||||||
|
@ -426,17 +389,23 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
else /* output alpha-channel as pgm file */
|
else /* output alpha-channel as pgm file */
|
||||||
{
|
{
|
||||||
if (raw)
|
if (raw)
|
||||||
|
{
|
||||||
fputc ((int) *pix_ptr++, alpha_file);
|
fputc ((int) *pix_ptr++, alpha_file);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
{
|
{
|
||||||
dep_16 = (long) *pix_ptr++;
|
dep_16 = (long) *pix_ptr++;
|
||||||
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
} /* if alpha_present */
|
}
|
||||||
|
}
|
||||||
|
} /* end if alpha_present */
|
||||||
|
|
||||||
if (!raw)
|
if (!raw)
|
||||||
if (col % 4 == 3)
|
if (col % 4 == 3)
|
||||||
|
@ -448,13 +417,11 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
fprintf (pnm_file, "\n");
|
fprintf (pnm_file, "\n");
|
||||||
} /* end for row */
|
} /* end for row */
|
||||||
|
|
||||||
if (row_pointers != (unsigned char**) NULL)
|
if (row_pointers != NULL)
|
||||||
free (row_pointers);
|
free (row_pointers);
|
||||||
if (png_pixels != (unsigned char*) NULL)
|
if (png_pixels != NULL)
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
|
|
||||||
PNGMINUS_UNUSED(raw); /* to quiet a Coverity defect */
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} /* end of source */
|
} /* end of source */
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# -- full-color
|
# -- full-color
|
||||||
./png2pnm -noraw ../pngsuite/basn2c08.png basn2c08.ppm
|
./png2pnm -noraw ../pngsuite/basn2c08.png basn2c08.ppm
|
||||||
./png2pnm -noraw ../pngsuite/basn2c16.png basn2c16.ppm
|
./png2pnm -noraw ../pngsuite/basn2c16.png basn2c16.ppm
|
||||||
# -- palletted
|
# -- paletted
|
||||||
./png2pnm -noraw ../pngsuite/basn3p01.png basn3p01.ppm
|
./png2pnm -noraw ../pngsuite/basn3p01.png basn3p01.ppm
|
||||||
./png2pnm -noraw ../pngsuite/basn3p02.png basn3p02.ppm
|
./png2pnm -noraw ../pngsuite/basn3p02.png basn3p02.ppm
|
||||||
./png2pnm -noraw ../pngsuite/basn3p04.png basn3p04.ppm
|
./png2pnm -noraw ../pngsuite/basn3p04.png basn3p04.ppm
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
# -- full-color
|
# -- full-color
|
||||||
./png2pnm -raw ../pngsuite/basn2c08.png rawn2c08.ppm
|
./png2pnm -raw ../pngsuite/basn2c08.png rawn2c08.ppm
|
||||||
./png2pnm -raw ../pngsuite/basn2c16.png rawn2c16.ppm
|
./png2pnm -raw ../pngsuite/basn2c16.png rawn2c16.ppm
|
||||||
# -- palletted
|
# -- paletted
|
||||||
./png2pnm -raw ../pngsuite/basn3p01.png rawn3p01.ppm
|
./png2pnm -raw ../pngsuite/basn3p01.png rawn3p01.ppm
|
||||||
./png2pnm -raw ../pngsuite/basn3p02.png rawn3p02.ppm
|
./png2pnm -raw ../pngsuite/basn3p02.png rawn3p02.ppm
|
||||||
./png2pnm -raw ../pngsuite/basn3p04.png rawn3p04.ppm
|
./png2pnm -raw ../pngsuite/basn3p04.png rawn3p04.ppm
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
make -f makefile.tc3
|
make
|
||||||
call png2pnm.bat
|
call png2pnm.bat
|
||||||
call pnm2png.bat
|
call pnm2png.bat
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
make -f makefile.std
|
make
|
||||||
sh png2pnm.sh
|
sh png2pnm.sh
|
||||||
sh pnm2png.sh
|
sh pnm2png.sh
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ pnm2png.exe basn0g16.pgm basn0g16.png
|
||||||
REM -- full-color
|
REM -- full-color
|
||||||
pnm2png.exe basn2c08.ppm basn2c08.png
|
pnm2png.exe basn2c08.ppm basn2c08.png
|
||||||
pnm2png.exe basn2c16.ppm basn2c16.png
|
pnm2png.exe basn2c16.ppm basn2c16.png
|
||||||
REM -- palletted
|
REM -- paletted
|
||||||
pnm2png.exe basn3p01.ppm basn3p01.png
|
pnm2png.exe basn3p01.ppm basn3p01.png
|
||||||
pnm2png.exe basn3p02.ppm basn3p02.png
|
pnm2png.exe basn3p02.ppm basn3p02.png
|
||||||
pnm2png.exe basn3p04.ppm basn3p04.png
|
pnm2png.exe basn3p04.ppm basn3p04.png
|
||||||
|
@ -27,7 +27,7 @@ pnm2png.exe rawn0g16.pgm rawn0g16.png
|
||||||
REM -- full-color
|
REM -- full-color
|
||||||
pnm2png.exe rawn2c08.ppm rawn2c08.png
|
pnm2png.exe rawn2c08.ppm rawn2c08.png
|
||||||
pnm2png.exe rawn2c16.ppm rawn2c16.png
|
pnm2png.exe rawn2c16.ppm rawn2c16.png
|
||||||
REM -- palletted
|
REM -- paletted
|
||||||
pnm2png.exe rawn3p01.ppm rawn3p01.png
|
pnm2png.exe rawn3p01.ppm rawn3p01.png
|
||||||
pnm2png.exe rawn3p02.ppm rawn3p02.png
|
pnm2png.exe rawn3p02.ppm rawn3p02.png
|
||||||
pnm2png.exe rawn3p04.ppm rawn3p04.png
|
pnm2png.exe rawn3p04.ppm rawn3p04.png
|
||||||
|
|
|
@ -1,29 +1,14 @@
|
||||||
/*
|
/*
|
||||||
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
|
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
|
||||||
* copyright (C) 1999,2015,2017 by Willem van Schaik <willem at schaik.com>
|
* copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||||
*
|
*
|
||||||
* version 1.0 - 1999.10.15 - First version.
|
* This software is released under the MIT license. For conditions of
|
||||||
* version 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
|
* distribution and use, see the LICENSE file part of this package.
|
||||||
* version 1.2 - 2017.04.22 - Add buffer-size check
|
|
||||||
* 1.3 - 2017.08.24 - Fix potential overflow in buffer-size check
|
|
||||||
* (Glenn Randers-Pehrson)
|
|
||||||
* 1.4 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software and
|
|
||||||
* its documentation for any purpose and without fee is hereby granted,
|
|
||||||
* provided that the above copyright notice appear in all copies and
|
|
||||||
* that both that copyright notice and this permission notice appear in
|
|
||||||
* supporting documentation. This software is provided "as is" without
|
|
||||||
* express or implied warranty.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef __TURBOC__
|
|
||||||
#include <mem.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
#ifndef BOOL
|
#ifndef BOOL
|
||||||
#define BOOL unsigned char
|
#define BOOL unsigned char
|
||||||
|
@ -35,38 +20,20 @@
|
||||||
#define FALSE (BOOL) 0
|
#define FALSE (BOOL) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STDIN 0
|
/* make pnm2png verbose so we can find problems (needs to be before png.h) */
|
||||||
#define STDOUT 1
|
|
||||||
#define STDERR 2
|
|
||||||
|
|
||||||
/* to make pnm2png verbose so we can find problems (needs to be before png.h) */
|
|
||||||
#ifndef PNG_DEBUG
|
#ifndef PNG_DEBUG
|
||||||
#define PNG_DEBUG 0
|
#define PNG_DEBUG 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
|
|
||||||
#ifndef png_jmpbuf
|
|
||||||
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PNGMINUS_UNUSED
|
|
||||||
/* Unused formal parameter warnings are silenced using the following macro
|
|
||||||
* which is expected to have no bad effects on performance (optimizing
|
|
||||||
* compilers will probably remove it entirely).
|
|
||||||
*/
|
|
||||||
# define PNGMINUS_UNUSED(param) (void)param
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* function prototypes */
|
/* function prototypes */
|
||||||
|
|
||||||
int main (int argc, char *argv[]);
|
int main (int argc, char *argv[]);
|
||||||
void usage ();
|
void usage ();
|
||||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
|
||||||
BOOL alpha);
|
BOOL interlace, BOOL alpha);
|
||||||
void get_token(FILE *pnm_file, char *token);
|
void get_token (FILE *pnm_file, char *token_buf, size_t token_buf_size);
|
||||||
png_uint_32 get_data (FILE *pnm_file, int depth);
|
png_uint_32 get_data (FILE *pnm_file, int depth);
|
||||||
png_uint_32 get_value (FILE *pnm_file, int depth);
|
png_uint_32 get_value (FILE *pnm_file, int depth);
|
||||||
|
|
||||||
|
@ -143,16 +110,14 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
} /* end for */
|
} /* end for */
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||||
/* set stdin/stdout to binary, we're reading the PNM always! in binary format */
|
/* set stdin/stdout to binary,
|
||||||
|
* we're reading the PNM always! in binary format
|
||||||
|
*/
|
||||||
if (fp_rd == stdin)
|
if (fp_rd == stdin)
|
||||||
{
|
setmode (fileno (stdin), O_BINARY);
|
||||||
setmode (STDIN, O_BINARY);
|
|
||||||
}
|
|
||||||
if (fp_wr == stdout)
|
if (fp_wr == stdout)
|
||||||
{
|
setmode (fileno (stdout), O_BINARY);
|
||||||
setmode (STDOUT, O_BINARY);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* call the conversion program itself */
|
/* call the conversion program itself */
|
||||||
|
@ -182,11 +147,6 @@ void usage()
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNM2PNG\n");
|
fprintf (stderr, "PNM2PNG\n");
|
||||||
fprintf (stderr, " by Willem van Schaik, 1999\n");
|
fprintf (stderr, " by Willem van Schaik, 1999\n");
|
||||||
#ifdef __TURBOC__
|
|
||||||
fprintf (stderr, " for Turbo-C and Borland-C compilers\n");
|
|
||||||
#else
|
|
||||||
fprintf (stderr, " for Linux (and Unix) compilers\n");
|
|
||||||
#endif
|
|
||||||
fprintf (stderr, "Usage: pnm2png [options] <file>.<pnm> [<file>.png]\n");
|
fprintf (stderr, "Usage: pnm2png [options] <file>.<pnm> [<file>.png]\n");
|
||||||
fprintf (stderr, " or: ... | pnm2png [options]\n");
|
fprintf (stderr, " or: ... | pnm2png [options]\n");
|
||||||
fprintf (stderr, "Options:\n");
|
fprintf (stderr, "Options:\n");
|
||||||
|
@ -200,8 +160,8 @@ void usage()
|
||||||
* pnm2png
|
* pnm2png
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
|
||||||
BOOL alpha)
|
BOOL interlace, BOOL alpha)
|
||||||
{
|
{
|
||||||
png_struct *png_ptr = NULL;
|
png_struct *png_ptr = NULL;
|
||||||
png_info *info_ptr = NULL;
|
png_info *info_ptr = NULL;
|
||||||
|
@ -235,7 +195,7 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
|
|
||||||
/* read header of PNM file */
|
/* read header of PNM file */
|
||||||
|
|
||||||
get_token(pnm_file, type_token);
|
get_token (pnm_file, type_token, sizeof (type_token));
|
||||||
if (type_token[0] != 'P')
|
if (type_token[0] != 'P')
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -245,10 +205,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
raw = (type_token[1] == '4');
|
raw = (type_token[1] == '4');
|
||||||
color_type = PNG_COLOR_TYPE_GRAY;
|
color_type = PNG_COLOR_TYPE_GRAY;
|
||||||
get_token(pnm_file, width_token);
|
get_token (pnm_file, width_token, sizeof (width_token));
|
||||||
sscanf (width_token, "%lu", &ul_width);
|
sscanf (width_token, "%lu", &ul_width);
|
||||||
width = (png_uint_32) ul_width;
|
width = (png_uint_32) ul_width;
|
||||||
get_token(pnm_file, height_token);
|
get_token (pnm_file, height_token, sizeof (height_token));
|
||||||
sscanf (height_token, "%lu", &ul_height);
|
sscanf (height_token, "%lu", &ul_height);
|
||||||
height = (png_uint_32) ul_height;
|
height = (png_uint_32) ul_height;
|
||||||
bit_depth = 1;
|
bit_depth = 1;
|
||||||
|
@ -256,19 +216,20 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and\n");
|
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and\n");
|
||||||
fprintf (stderr, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
|
fprintf (stderr, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
|
||||||
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
||||||
{
|
{
|
||||||
raw = (type_token[1] == '5');
|
raw = (type_token[1] == '5');
|
||||||
color_type = PNG_COLOR_TYPE_GRAY;
|
color_type = PNG_COLOR_TYPE_GRAY;
|
||||||
get_token(pnm_file, width_token);
|
get_token (pnm_file, width_token, sizeof (width_token));
|
||||||
sscanf (width_token, "%lu", &ul_width);
|
sscanf (width_token, "%lu", &ul_width);
|
||||||
width = (png_uint_32) ul_width;
|
width = (png_uint_32) ul_width;
|
||||||
get_token(pnm_file, height_token);
|
get_token (pnm_file, height_token, sizeof (height_token));
|
||||||
sscanf (height_token, "%lu", &ul_height);
|
sscanf (height_token, "%lu", &ul_height);
|
||||||
height = (png_uint_32) ul_height;
|
height = (png_uint_32) ul_height;
|
||||||
get_token(pnm_file, maxval_token);
|
get_token (pnm_file, maxval_token, sizeof (maxval_token));
|
||||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||||
maxval = (png_uint_32) ul_maxval;
|
maxval = (png_uint_32) ul_maxval;
|
||||||
|
|
||||||
|
@ -280,20 +241,22 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
bit_depth = 4;
|
bit_depth = 4;
|
||||||
else if (maxval <= 255)
|
else if (maxval <= 255)
|
||||||
bit_depth = 8;
|
bit_depth = 8;
|
||||||
else /* if (maxval <= 65535) */
|
else if (maxval <= 65535U)
|
||||||
bit_depth = 16;
|
bit_depth = 16;
|
||||||
|
else /* maxval > 65535U */
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
else if ((type_token[1] == '3') || (type_token[1] == '6'))
|
else if ((type_token[1] == '3') || (type_token[1] == '6'))
|
||||||
{
|
{
|
||||||
raw = (type_token[1] == '6');
|
raw = (type_token[1] == '6');
|
||||||
color_type = PNG_COLOR_TYPE_RGB;
|
color_type = PNG_COLOR_TYPE_RGB;
|
||||||
get_token(pnm_file, width_token);
|
get_token (pnm_file, width_token, sizeof (width_token));
|
||||||
sscanf (width_token, "%lu", &ul_width);
|
sscanf (width_token, "%lu", &ul_width);
|
||||||
width = (png_uint_32) ul_width;
|
width = (png_uint_32) ul_width;
|
||||||
get_token(pnm_file, height_token);
|
get_token (pnm_file, height_token, sizeof (height_token));
|
||||||
sscanf (height_token, "%lu", &ul_height);
|
sscanf (height_token, "%lu", &ul_height);
|
||||||
height = (png_uint_32) ul_height;
|
height = (png_uint_32) ul_height;
|
||||||
get_token(pnm_file, maxval_token);
|
get_token (pnm_file, maxval_token, sizeof (maxval_token));
|
||||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||||
maxval = (png_uint_32) ul_maxval;
|
maxval = (png_uint_32) ul_maxval;
|
||||||
if (maxval <= 1)
|
if (maxval <= 1)
|
||||||
|
@ -304,8 +267,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
bit_depth = 4;
|
bit_depth = 4;
|
||||||
else if (maxval <= 255)
|
else if (maxval <= 255)
|
||||||
bit_depth = 8;
|
bit_depth = 8;
|
||||||
else /* if (maxval <= 65535) */
|
else if (maxval <= 65535U)
|
||||||
bit_depth = 16;
|
bit_depth = 16;
|
||||||
|
else /* maxval > 65535U */
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -321,7 +286,7 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
if (color_type == PNG_COLOR_TYPE_RGB)
|
if (color_type == PNG_COLOR_TYPE_RGB)
|
||||||
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||||
|
|
||||||
get_token(alpha_file, type_token);
|
get_token (alpha_file, type_token, sizeof (type_token));
|
||||||
if (type_token[0] != 'P')
|
if (type_token[0] != 'P')
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -329,17 +294,17 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
||||||
{
|
{
|
||||||
alpha_raw = (type_token[1] == '5');
|
alpha_raw = (type_token[1] == '5');
|
||||||
get_token(alpha_file, width_token);
|
get_token (alpha_file, width_token, sizeof (width_token));
|
||||||
sscanf (width_token, "%lu", &ul_alpha_width);
|
sscanf (width_token, "%lu", &ul_alpha_width);
|
||||||
alpha_width = (png_uint_32) ul_alpha_width;
|
alpha_width = (png_uint_32) ul_alpha_width;
|
||||||
if (alpha_width != width)
|
if (alpha_width != width)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
get_token(alpha_file, height_token);
|
get_token (alpha_file, height_token, sizeof (height_token));
|
||||||
sscanf (height_token, "%lu", &ul_alpha_height);
|
sscanf (height_token, "%lu", &ul_alpha_height);
|
||||||
alpha_height = (png_uint_32) ul_alpha_height;
|
alpha_height = (png_uint_32) ul_alpha_height;
|
||||||
if (alpha_height != height)
|
if (alpha_height != height)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
get_token(alpha_file, maxval_token);
|
get_token (alpha_file, maxval_token, sizeof (maxval_token));
|
||||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||||
maxval = (png_uint_32) ul_maxval;
|
maxval = (png_uint_32) ul_maxval;
|
||||||
if (maxval <= 1)
|
if (maxval <= 1)
|
||||||
|
@ -350,8 +315,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
alpha_depth = 4;
|
alpha_depth = 4;
|
||||||
else if (maxval <= 255)
|
else if (maxval <= 255)
|
||||||
alpha_depth = 8;
|
alpha_depth = 8;
|
||||||
else /* if (maxval <= 65535) */
|
else if (maxval <= 65535U)
|
||||||
alpha_depth = 16;
|
alpha_depth = 16;
|
||||||
|
else /* maxval > 65535U */
|
||||||
|
return FALSE;
|
||||||
if (alpha_depth != bit_depth)
|
if (alpha_depth != bit_depth)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -379,21 +346,29 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
|
|
||||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
if (packed_bitmap)
|
if (packed_bitmap)
|
||||||
|
{
|
||||||
/* row data is as many bytes as can fit width x channels x bit_depth */
|
/* row data is as many bytes as can fit width x channels x bit_depth */
|
||||||
row_bytes = (width * channels * bit_depth + 7) / 8;
|
row_bytes = (width * channels * bit_depth + 7) / 8;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||||
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
||||||
|
}
|
||||||
|
|
||||||
if ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes))
|
if ((row_bytes == 0) ||
|
||||||
|
((size_t) height > (size_t) (-1) / (size_t) row_bytes))
|
||||||
{
|
{
|
||||||
/* too big */
|
/* too big */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ((png_pixels = (png_byte *)
|
if ((png_pixels = (png_byte *)
|
||||||
malloc ((size_t)row_bytes * (size_t)height * sizeof (png_byte))) == NULL)
|
malloc ((size_t) row_bytes * (size_t) height)) == NULL)
|
||||||
|
{
|
||||||
|
/* out of memory */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* read data from PNM file */
|
/* read data from PNM file */
|
||||||
pix_ptr = png_pixels;
|
pix_ptr = png_pixels;
|
||||||
|
@ -404,9 +379,12 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
if (packed_bitmap)
|
if (packed_bitmap)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (int) row_bytes; i++)
|
for (i = 0; i < (int) row_bytes; i++)
|
||||||
|
{
|
||||||
/* png supports this format natively so no conversion is needed */
|
/* png supports this format natively so no conversion is needed */
|
||||||
*pix_ptr++ = get_data (pnm_file, 8);
|
*pix_ptr++ = get_data (pnm_file, 8);
|
||||||
} else
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
for (col = 0; col < (int) width; col++)
|
for (col = 0; col < (int) width; col++)
|
||||||
|
@ -414,10 +392,15 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
for (i = 0; i < (channels - alpha_present); i++)
|
for (i = 0; i < (channels - alpha_present); i++)
|
||||||
{
|
{
|
||||||
if (raw)
|
if (raw)
|
||||||
|
{
|
||||||
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
if (bit_depth <= 8)
|
if (bit_depth <= 8)
|
||||||
|
{
|
||||||
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp16 = get_value (pnm_file, bit_depth);
|
tmp16 = get_value (pnm_file, bit_depth);
|
||||||
|
@ -427,40 +410,45 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
pix_ptr++;
|
pix_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (alpha) /* read alpha-channel from pgm file */
|
if (alpha) /* read alpha-channel from pgm file */
|
||||||
{
|
{
|
||||||
if (alpha_raw)
|
if (alpha_raw)
|
||||||
|
{
|
||||||
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
if (alpha_depth <= 8)
|
if (alpha_depth <= 8)
|
||||||
|
{
|
||||||
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp16 = get_value (alpha_file, bit_depth);
|
tmp16 = get_value (alpha_file, bit_depth);
|
||||||
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||||
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
||||||
}
|
}
|
||||||
} /* if alpha */
|
}
|
||||||
} /* if packed_bitmap */
|
} /* end if alpha */
|
||||||
|
} /* end if packed_bitmap */
|
||||||
} /* end for col */
|
} /* end for col */
|
||||||
} /* end for row */
|
} /* end for row */
|
||||||
|
|
||||||
/* prepare the standard PNG structures */
|
/* prepare the standard PNG structures */
|
||||||
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL), NULL, NULL,
|
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL),
|
||||||
NULL);
|
NULL, NULL, NULL);
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
{
|
{
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
png_pixels = NULL;
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
info_ptr = png_create_info_struct (png_ptr);
|
info_ptr = png_create_info_struct (png_ptr);
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
png_destroy_write_struct (&png_ptr, NULL);
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
png_pixels = NULL;
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,12 +460,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* setjmp() must be called in every function that calls a PNG-reading libpng function */
|
|
||||||
if (setjmp (png_jmpbuf (png_ptr)))
|
if (setjmp (png_jmpbuf (png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
png_pixels = NULL;
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,14 +479,13 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
png_write_info (png_ptr, info_ptr);
|
png_write_info (png_ptr, info_ptr);
|
||||||
|
|
||||||
/* if needed we will allocate memory for an new array of row-pointers */
|
/* if needed we will allocate memory for an new array of row-pointers */
|
||||||
if (row_pointers == (unsigned char**) NULL)
|
if (row_pointers == NULL)
|
||||||
{
|
{
|
||||||
if ((row_pointers = (png_byte **)
|
if ((row_pointers = (png_byte **)
|
||||||
malloc (height * sizeof (png_bytep))) == NULL)
|
malloc (height * sizeof (png_byte *))) == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
png_pixels = NULL;
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,23 +503,21 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
/* clean up after the write, and free any memory allocated */
|
/* clean up after the write, and free any memory allocated */
|
||||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||||
|
|
||||||
if (row_pointers != (unsigned char**) NULL)
|
if (row_pointers != NULL)
|
||||||
free (row_pointers);
|
free (row_pointers);
|
||||||
if (png_pixels != (unsigned char*) NULL)
|
if (png_pixels != NULL)
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
|
|
||||||
PNGMINUS_UNUSED(raw); /* Quiet a Coverity defect */
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} /* end of pnm2png */
|
} /* end of pnm2png */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_token() - gets the first string after whitespace
|
* get_token - gets the first string after whitespace
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void get_token(FILE *pnm_file, char *token)
|
void get_token (FILE *pnm_file, char *token_buf, size_t token_buf_size)
|
||||||
{
|
{
|
||||||
int i = 0;
|
size_t i = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* remove white-space and comment lines */
|
/* remove white-space and comment lines */
|
||||||
|
@ -551,27 +534,27 @@ void get_token(FILE *pnm_file, char *token)
|
||||||
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
|
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
|
||||||
}
|
}
|
||||||
if (ret == EOF) break;
|
if (ret == EOF) break;
|
||||||
token[i] = (unsigned char) ret;
|
token_buf[i] = (char) ret;
|
||||||
}
|
}
|
||||||
while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' '));
|
while ((ret == '\n') || (ret == '\r') || (ret == ' '));
|
||||||
|
|
||||||
/* read string */
|
/* read string */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = fgetc (pnm_file);
|
ret = fgetc (pnm_file);
|
||||||
if (ret == EOF) break;
|
if (ret == EOF) break;
|
||||||
i++;
|
if (++i == token_buf_size - 1) break;
|
||||||
token[i] = (unsigned char) ret;
|
token_buf[i] = (char) ret;
|
||||||
}
|
}
|
||||||
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
|
while ((ret != '\n') && (ret != '\r') && (ret != ' '));
|
||||||
|
|
||||||
token[i] = '\0';
|
token_buf[i] = '\0';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_data() - takes first byte and converts into next pixel value,
|
* get_data - takes first byte and converts into next pixel value,
|
||||||
* taking as much bits as defined by bit-depth and
|
* taking as much bits as defined by bit-depth and
|
||||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
||||||
*/
|
*/
|
||||||
|
@ -605,14 +588,14 @@ png_uint_32 get_data (FILE *pnm_file, int depth)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_value() - takes first (numeric) string and converts into number,
|
* get_value - takes first (numeric) string and converts into number,
|
||||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
png_uint_32 get_value (FILE *pnm_file, int depth)
|
png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||||
{
|
{
|
||||||
static png_uint_32 mask = 0;
|
static png_uint_32 mask = 0;
|
||||||
png_byte token[16];
|
char token[16];
|
||||||
unsigned long ul_ret_value;
|
unsigned long ul_ret_value;
|
||||||
png_uint_32 ret_value;
|
png_uint_32 ret_value;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -621,8 +604,8 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||||
for (i = 0; i < depth; i++)
|
for (i = 0; i < depth; i++)
|
||||||
mask = (mask << 1) | 0x01;
|
mask = (mask << 1) | 0x01;
|
||||||
|
|
||||||
get_token (pnm_file, (char *) token);
|
get_token (pnm_file, token, sizeof (token));
|
||||||
sscanf ((const char *) token, "%lu", &ul_ret_value);
|
sscanf (token, "%lu", &ul_ret_value);
|
||||||
ret_value = (png_uint_32) ul_ret_value;
|
ret_value = (png_uint_32) ul_ret_value;
|
||||||
|
|
||||||
ret_value &= mask;
|
ret_value &= mask;
|
||||||
|
@ -635,4 +618,3 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end of source */
|
/* end of source */
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# -- full-color
|
# -- full-color
|
||||||
./pnm2png basn2c08.ppm basn2c08.png
|
./pnm2png basn2c08.ppm basn2c08.png
|
||||||
./pnm2png basn2c16.ppm basn2c16.png
|
./pnm2png basn2c16.ppm basn2c16.png
|
||||||
# -- palletted
|
# -- paletted
|
||||||
./pnm2png basn3p01.ppm basn3p01.png
|
./pnm2png basn3p01.ppm basn3p01.png
|
||||||
./pnm2png basn3p02.ppm basn3p02.png
|
./pnm2png basn3p02.ppm basn3p02.png
|
||||||
./pnm2png basn3p04.ppm basn3p04.png
|
./pnm2png basn3p04.ppm basn3p04.png
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
# -- full-color
|
# -- full-color
|
||||||
./pnm2png rawn2c08.ppm rawn2c08.png
|
./pnm2png rawn2c08.ppm rawn2c08.png
|
||||||
./pnm2png rawn2c16.ppm rawn2c16.png
|
./pnm2png rawn2c16.ppm rawn2c16.png
|
||||||
# -- palletted
|
# -- paletted
|
||||||
./pnm2png rawn3p01.ppm rawn3p01.png
|
./pnm2png rawn3p01.ppm rawn3p01.png
|
||||||
./pnm2png rawn3p02.ppm rawn3p02.png
|
./pnm2png rawn3p02.ppm rawn3p02.png
|
||||||
./pnm2png rawn3p04.ppm rawn3p04.png
|
./pnm2png rawn3p04.ppm rawn3p04.png
|
||||||
|
|
|
@ -16,6 +16,8 @@ chunks, etc.
|
||||||
The "ft*.png" images are "free/libre" replacements for the transparent
|
The "ft*.png" images are "free/libre" replacements for the transparent
|
||||||
corresponding t*.png images in the PngSuite.
|
corresponding t*.png images in the PngSuite.
|
||||||
|
|
||||||
|
The "i*.png" images are the same images, but interlaced.
|
||||||
|
|
||||||
The images in this directory represent the basic PNG color-types:
|
The images in this directory represent the basic PNG color-types:
|
||||||
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
||||||
(1-8 bit) and grayscale or color images with alpha channel. You
|
(1-8 bit) and grayscale or color images with alpha channel. You
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
basn0g01.png
|
||||||
|
basn0g02.png
|
||||||
|
basn0g04.png
|
||||||
|
basn3p01.png
|
||||||
|
basn3p02.png
|
||||||
|
basn3p04.png
|
||||||
|
ftbbn0g01.png
|
||||||
|
ftbbn0g02.png
|
||||||
|
ftbbn0g04.png
|
After Width: | Height: | Size: 237 B |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 299 B |
After Width: | Height: | Size: 558 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 198 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 339 B |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 847 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
These images fail the "pngimage-quick" and "pngimage-full" tests.
|
After Width: | Height: | Size: 201 B |
After Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 116 B |
After Width: | Height: | Size: 163 B |
After Width: | Height: | Size: 288 B |
After Width: | Height: | Size: 214 B |
After Width: | Height: | Size: 211 B |
After Width: | Height: | Size: 489 B |
|
@ -46,7 +46,7 @@ everything should be static. It must define the function:
|
||||||
|
|
||||||
static int png_have_vsx(png_structp png_ptr);
|
static int png_have_vsx(png_structp png_ptr);
|
||||||
|
|
||||||
That function must return 1 if ARM NEON instructions are supported, 0 if not.
|
That function must return 1 if POWERPC_VSX instructions are supported, 0 if not.
|
||||||
It must not execute png_error unless it detects a bug. A png_error will prevent
|
It must not execute png_error unless it detects a bug. A png_error will prevent
|
||||||
the reading of the PNG and in the future, writing too.
|
the reading of the PNG and in the future, writing too.
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
static int
|
static int
|
||||||
png_have_vsx(png_structp png_ptr)
|
png_have_vsx(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
|
unsigned long auxv = getauxval(AT_HWCAP);
|
||||||
const unsigned long auxv = getauxval( AT_HWCAP );
|
|
||||||
|
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
|
|
||||||
|
@ -33,4 +32,3 @@ png_have_vsx(png_structp png_ptr)
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ case "$1" in
|
||||||
--coverage)
|
--coverage)
|
||||||
# Comments below indicate cases known to be required and not duplicated
|
# Comments below indicate cases known to be required and not duplicated
|
||||||
# in other (required) cases; the aim is to get a minimal set that gives
|
# in other (required) cases; the aim is to get a minimal set that gives
|
||||||
# the maxium code coverage.
|
# the maximum code coverage.
|
||||||
mpg none gray-alpha 8 # required: code coverage, sRGB opaque component
|
mpg none gray-alpha 8 # required: code coverage, sRGB opaque component
|
||||||
mpg none palette 8 # required: basic palette read
|
mpg none palette 8 # required: basic palette read
|
||||||
mpg 1.8 gray 2 # required: tests gamma threshold code
|
mpg 1.8 gray 2 # required: tests gamma threshold code
|
||||||
|
|
|
@ -54,7 +54,7 @@ doed(){
|
||||||
}
|
}
|
||||||
|
|
||||||
# In beta versions the version string which appears in files can be a little
|
# In beta versions the version string which appears in files can be a little
|
||||||
# long and cause spuriously overlong lines. To avoid this subtitute the version
|
# long and cause spuriously overlong lines. To avoid this substitute the version
|
||||||
# string with a 'standard' version a.b.cc before checking for long lines.
|
# string with a 'standard' version a.b.cc before checking for long lines.
|
||||||
if test -r png.h
|
if test -r png.h
|
||||||
then
|
then
|
||||||
|
|
|
@ -388,7 +388,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
if (!test_only)
|
if (!test_only)
|
||||||
{
|
{
|
||||||
printf("PNG_CONST png_uint_16 png_sRGB_table[256] =\n{\n ");
|
printf("const png_uint_16 png_sRGB_table[256] =\n{\n ");
|
||||||
for (i=0; i<255; )
|
for (i=0; i<255; )
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
@ -401,7 +401,7 @@ main(int argc, char **argv)
|
||||||
printf("%d\n};\n\n", png_sRGB_table[i]);
|
printf("%d\n};\n\n", png_sRGB_table[i]);
|
||||||
|
|
||||||
|
|
||||||
printf("PNG_CONST png_uint_16 png_sRGB_base[512] =\n{\n ");
|
printf("const png_uint_16 png_sRGB_base[512] =\n{\n ");
|
||||||
for (i=0; i<511; )
|
for (i=0; i<511; )
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
@ -413,7 +413,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
printf("%d\n};\n\n", png_sRGB_base[i]);
|
printf("%d\n};\n\n", png_sRGB_base[i]);
|
||||||
|
|
||||||
printf("PNG_CONST png_byte png_sRGB_delta[512] =\n{\n ");
|
printf("const png_byte png_sRGB_delta[512] =\n{\n ");
|
||||||
for (i=0; i<511; )
|
for (i=0; i<511; )
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
|
@ -191,7 +191,7 @@ vl_strategy[] =
|
||||||
/* This controls the order of search. */
|
/* This controls the order of search. */
|
||||||
{ "huffman", Z_HUFFMAN_ONLY },
|
{ "huffman", Z_HUFFMAN_ONLY },
|
||||||
{ "RLE", Z_RLE },
|
{ "RLE", Z_RLE },
|
||||||
{ "fixed", Z_FIXED }, /* the remainder do window searchs */
|
{ "fixed", Z_FIXED }, /* the remainder do window searches */
|
||||||
{ "filtered", Z_FILTERED },
|
{ "filtered", Z_FILTERED },
|
||||||
{ "default", Z_DEFAULT_STRATEGY },
|
{ "default", Z_DEFAULT_STRATEGY },
|
||||||
{ all, 0 }
|
{ all, 0 }
|
||||||
|
@ -336,7 +336,7 @@ static const option options[] =
|
||||||
# define VLC(name) VLCIDAT(name) VLCiCCP(name) VLCzTXt(name)
|
# define VLC(name) VLCIDAT(name) VLCiCCP(name) VLCzTXt(name)
|
||||||
|
|
||||||
# ifdef PNG_SW_COMPRESS_png_level
|
# ifdef PNG_SW_COMPRESS_png_level
|
||||||
/* The libpng compression level isn't searched beause it justs sets the
|
/* The libpng compression level isn't searched because it justs sets the
|
||||||
* other things that are searched!
|
* other things that are searched!
|
||||||
*/
|
*/
|
||||||
VLO("compression", compression, 0)
|
VLO("compression", compression, 0)
|
||||||
|
@ -735,7 +735,7 @@ option_index(struct display *dp, const char *opt, size_t len)
|
||||||
static int
|
static int
|
||||||
get_option(struct display *dp, const char *opt, int *value)
|
get_option(struct display *dp, const char *opt, int *value)
|
||||||
{
|
{
|
||||||
const png_byte i = option_index(dp, opt, strlen(opt));
|
png_byte i = option_index(dp, opt, strlen(opt));
|
||||||
|
|
||||||
if (dp->entry[i]) /* option was set on command line */
|
if (dp->entry[i]) /* option was set on command line */
|
||||||
{
|
{
|
||||||
|
@ -789,7 +789,7 @@ record_opt(struct display *dp, png_byte opt, const char *entry_name)
|
||||||
* numerical value.
|
* numerical value.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
const unsigned int sp = dp->csp; /* stack entry of next searched option */
|
unsigned int sp = dp->csp; /* stack entry of next searched option */
|
||||||
|
|
||||||
if (sp >= dp->tsp)
|
if (sp >= dp->tsp)
|
||||||
{
|
{
|
||||||
|
@ -797,7 +797,7 @@ record_opt(struct display *dp, png_byte opt, const char *entry_name)
|
||||||
* searched entry or the start of the dp->curr buffer if there is nothing
|
* searched entry or the start of the dp->curr buffer if there is nothing
|
||||||
* on the stack yet (sp == 0).
|
* on the stack yet (sp == 0).
|
||||||
*/
|
*/
|
||||||
const int offset = set_opt_string_(dp, sp, opt, entry_name);
|
int offset = set_opt_string_(dp, sp, opt, entry_name);
|
||||||
|
|
||||||
if (sp > 0)
|
if (sp > 0)
|
||||||
dp->stack[sp-1].opt_string_end = offset;
|
dp->stack[sp-1].opt_string_end = offset;
|
||||||
|
@ -1222,7 +1222,7 @@ advance_opt(struct display *dp, png_byte opt, int search)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getallopts_(struct display *dp, const png_byte opt, int *value, int record)
|
getallopts_(struct display *dp, png_byte opt, int *value, int record)
|
||||||
/* Like getop but iterate over all the values if the option was set to "all".
|
/* Like getop but iterate over all the values if the option was set to "all".
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
@ -1259,7 +1259,7 @@ getsearchopts(struct display *dp, const char *opt_str, int *value)
|
||||||
/* As above except that if the option was not set try a search */
|
/* As above except that if the option was not set try a search */
|
||||||
{
|
{
|
||||||
png_byte istrat;
|
png_byte istrat;
|
||||||
const png_byte opt = option_index(dp, opt_str, strlen(opt_str));
|
png_byte opt = option_index(dp, opt_str, strlen(opt_str));
|
||||||
int record = options[opt].search;
|
int record = options[opt].search;
|
||||||
const char *entry_name;
|
const char *entry_name;
|
||||||
|
|
||||||
|
@ -1725,7 +1725,7 @@ display_start_read(struct display *dp, const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PNGCBAPI
|
static void PNGCBAPI
|
||||||
read_function(png_structp pp, png_bytep data, png_size_t size)
|
read_function(png_structp pp, png_bytep data, size_t size)
|
||||||
{
|
{
|
||||||
struct display *dp = get_dp(pp);
|
struct display *dp = get_dp(pp);
|
||||||
|
|
||||||
|
@ -1881,7 +1881,7 @@ display_start_write(struct display *dp, const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PNGCBAPI
|
static void PNGCBAPI
|
||||||
write_function(png_structp pp, png_bytep data, png_size_t size)
|
write_function(png_structp pp, png_bytep data, size_t size)
|
||||||
{
|
{
|
||||||
struct display *dp = get_dp(pp);
|
struct display *dp = get_dp(pp);
|
||||||
|
|
||||||
|
@ -2117,7 +2117,7 @@ better_options(const struct display *dp)
|
||||||
*
|
*
|
||||||
* This function looks through the stack from the bottom up looking for an
|
* This function looks through the stack from the bottom up looking for an
|
||||||
* option that does not match the current best value. When it finds one it
|
* option that does not match the current best value. When it finds one it
|
||||||
* checks to see if it is more or less desireable and returns true or false
|
* checks to see if it is more or less desirable and returns true or false
|
||||||
* as appropriate.
|
* as appropriate.
|
||||||
*
|
*
|
||||||
* Notice that this means that the order options are pushed onto the stack
|
* Notice that this means that the order options are pushed onto the stack
|
||||||
|
@ -2220,7 +2220,7 @@ cp_one_file(struct display *dp, const char *filename, const char *destname)
|
||||||
strcpy(dp->best, dp->curr);
|
strcpy(dp->best, dp->curr);
|
||||||
dp->best_size = dp->write_size;
|
dp->best_size = dp->write_size;
|
||||||
|
|
||||||
if (dp->nsp > 0) /* interating over lists */
|
if (dp->nsp > 0) /* iterating over lists */
|
||||||
{
|
{
|
||||||
char *tmpname, tmpbuf[(sizeof dp->namebuf) + 4];
|
char *tmpname, tmpbuf[(sizeof dp->namebuf) + 4];
|
||||||
assert(dp->curr[0] == ' ' && dp->tsp > 0);
|
assert(dp->curr[0] == ' ' && dp->tsp > 0);
|
||||||
|
@ -2302,7 +2302,7 @@ cppng(struct display *dp, const char *file, const char *gv dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(const int argc, const char * const * const argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* For each file on the command line test it with a range of transforms */
|
/* For each file on the command line test it with a range of transforms */
|
||||||
int option_end;
|
int option_end;
|
||||||
|
@ -2379,7 +2379,7 @@ main(const int argc, const char * const * const argv)
|
||||||
/* Here on any return, including failures, except user/internal issues
|
/* Here on any return, including failures, except user/internal issues
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
const int pass = (d.options & STRICT) ?
|
int pass = (d.options & STRICT) ?
|
||||||
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
|
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
|
||||||
|
|
||||||
if (!pass)
|
if (!pass)
|
||||||
|
|
|
@ -772,7 +772,7 @@ skip_chunk_type(const struct global *global, png_uint_32 type)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Chunks that specify gamma encoding which should therefore only be
|
/* Chunks that specify gamma encoding which should therefore only be
|
||||||
* removed the the user insists:
|
* removed if the user insists:
|
||||||
*/
|
*/
|
||||||
case png_gAMA: case png_sRGB:
|
case png_gAMA: case png_sRGB:
|
||||||
if (global->skip >= SKIP_ALL)
|
if (global->skip >= SKIP_ALL)
|
||||||
|
@ -2363,7 +2363,7 @@ zlib_advance(struct zlib *zlib, png_uint_32 nbytes)
|
||||||
flush = Z_NO_FLUSH;
|
flush = Z_NO_FLUSH;
|
||||||
out_bytes = 0;
|
out_bytes = 0;
|
||||||
|
|
||||||
/* NOTE: expression 3 is only evaluted on 'continue', because of the
|
/* NOTE: expression 3 is only evaluated on 'continue', because of the
|
||||||
* 'break' at the end of this loop below.
|
* 'break' at the end of this loop below.
|
||||||
*/
|
*/
|
||||||
for (;endrc == ZLIB_OK;
|
for (;endrc == ZLIB_OK;
|
||||||
|
@ -2514,7 +2514,7 @@ zlib_run(struct zlib *zlib)
|
||||||
*/
|
*/
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const unsigned int count = list->count;
|
unsigned int count = list->count;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i<count; ++i)
|
for (i = 0; i<count; ++i)
|
||||||
|
@ -2664,7 +2664,7 @@ zlib_check(struct file *file, png_uint_32 offset)
|
||||||
* this case, so do the optimization anyway.
|
* this case, so do the optimization anyway.
|
||||||
*/
|
*/
|
||||||
if (zlib.cksum)
|
if (zlib.cksum)
|
||||||
chunk_message(zlib.chunk, "zlib checkum");
|
chunk_message(zlib.chunk, "zlib checksum");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2791,7 +2791,7 @@ process_chunk(struct file *file, png_uint_32 file_crc, png_uint_32 next_length,
|
||||||
* to read_chunk.
|
* to read_chunk.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
const png_uint_32 type = file->type;
|
png_uint_32 type = file->type;
|
||||||
|
|
||||||
if (file->global->verbose > 1)
|
if (file->global->verbose > 1)
|
||||||
{
|
{
|
||||||
|
@ -3152,7 +3152,7 @@ read_chunk(struct file *file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Control gets to here if the the stream seems invalid or damaged in some
|
/* Control gets to here if the stream seems invalid or damaged in some
|
||||||
* way. Either there was a problem reading all the expected data (this
|
* way. Either there was a problem reading all the expected data (this
|
||||||
* chunk's data, its CRC and the length and type of the next chunk) or the
|
* chunk's data, its CRC and the length and type of the next chunk) or the
|
||||||
* next chunk length/type are invalid. Notice that the cases that end up
|
* next chunk length/type are invalid. Notice that the cases that end up
|
||||||
|
@ -3678,7 +3678,7 @@ usage(const char *prog)
|
||||||
size_t i;
|
size_t i;
|
||||||
static const char *usage_string[] = {
|
static const char *usage_string[] = {
|
||||||
" Tests, optimizes and optionally fixes the zlib header in PNG files.",
|
" Tests, optimizes and optionally fixes the zlib header in PNG files.",
|
||||||
" Optionally, when fixing, strips ancilliary chunks from the file.",
|
" Optionally, when fixing, strips ancillary chunks from the file.",
|
||||||
0,
|
0,
|
||||||
"OPTIONS",
|
"OPTIONS",
|
||||||
" OPERATION",
|
" OPERATION",
|
||||||
|
@ -3710,7 +3710,7 @@ usage(const char *prog)
|
||||||
" practice most programs will ignore it.",
|
" practice most programs will ignore it.",
|
||||||
" bKGD [transform]: This is used by libpng transforms."
|
" bKGD [transform]: This is used by libpng transforms."
|
||||||
" --max=<number>:",
|
" --max=<number>:",
|
||||||
" Use IDAT chunks sized <number>. If no number is given the the IDAT",
|
" Use IDAT chunks sized <number>. If no number is given the IDAT",
|
||||||
" chunks will be the maximum size permitted; 2^31-1 bytes. If the option",
|
" chunks will be the maximum size permitted; 2^31-1 bytes. If the option",
|
||||||
" is omitted the original chunk sizes will not be changed. When the",
|
" is omitted the original chunk sizes will not be changed. When the",
|
||||||
" option is given --strip=unsafe is set automatically. This may be",
|
" option is given --strip=unsafe is set automatically. This may be",
|
||||||
|
|
|
@ -410,15 +410,14 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||||
#ifndef PNG_STDIO_SUPPORTED
|
#ifndef PNG_STDIO_SUPPORTED
|
||||||
|
|
||||||
static void
|
static void
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||||
{
|
{
|
||||||
png_size_t check;
|
size_t check;
|
||||||
|
|
||||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
/* fread() returns 0 on error, so it is OK to store this in a size_t
|
||||||
* instead of an int, which is what fread() actually returns.
|
* instead of an int, which is what fread() actually returns.
|
||||||
*/
|
*/
|
||||||
check = (png_size_t)fread(data, (png_size_t)1, length,
|
check = fread(data, 1, length, (FILE *)png_ptr->io_ptr);
|
||||||
(FILE *)png_ptr->io_ptr);
|
|
||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
{
|
{
|
||||||
|
@ -427,7 +426,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_write_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_uint_32 check;
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||||
int iWidth, int iHeight, png_color BkgColor);
|
int iWidth, int iHeight, png_color BkgColor);
|
||||||
|
|
||||||
#ifndef PNG_STDIO_SUPPORTED
|
#ifndef PNG_STDIO_SUPPORTED
|
||||||
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
static void png_read_data(png_structp png_ptr, png_bytep data, size_t length);
|
||||||
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
static void png_write_data(png_structp png_ptr, png_bytep data, size_t length);
|
||||||
static void png_flush(png_structp png_ptr);
|
static void png_flush(png_structp png_ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -716,7 +716,7 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
||||||
png_color bkgGray = {127, 127, 127};
|
png_color bkgGray = {127, 127, 127};
|
||||||
png_color bkgWhite = {255, 255, 255};
|
png_color bkgWhite = {255, 255, 255};
|
||||||
|
|
||||||
/* allocate memory for the Device Independant bitmap */
|
/* allocate memory for the Device Independent bitmap */
|
||||||
|
|
||||||
wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2;
|
wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# depcomp - compile a program generating dependencies as side-effects
|
# depcomp - compile a program generating dependencies as side-effects
|
||||||
|
|
||||||
scriptversion=2013-05-30.07; # UTC
|
scriptversion=2018-03-07.03; # UTC
|
||||||
|
|
||||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,7 +16,7 @@ scriptversion=2013-05-30.07; # UTC
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
|
@ -783,9 +783,9 @@ exit 0
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# mode: shell-script
|
# mode: shell-script
|
||||||
# sh-indentation: 2
|
# sh-indentation: 2
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||||
# time-stamp-start: "scriptversion="
|
# time-stamp-start: "scriptversion="
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
# time-stamp-time-zone: "UTC"
|
# time-stamp-time-zone: "UTC0"
|
||||||
# time-stamp-end: "; # UTC"
|
# time-stamp-end: "; # UTC"
|
||||||
# End:
|
# End:
|
||||||
|
|
|
@ -2,18 +2,20 @@
|
||||||
#if 0 /* in case someone actually tries to compile this */
|
#if 0 /* in case someone actually tries to compile this */
|
||||||
|
|
||||||
/* example.c - an example of using libpng
|
/* example.c - an example of using libpng
|
||||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
*
|
||||||
|
* Maintained 2018 Cosmin Truta
|
||||||
* Maintained 1998-2016 Glenn Randers-Pehrson
|
* Maintained 1998-2016 Glenn Randers-Pehrson
|
||||||
* Maintained 1996, 1997 Andreas Dilger)
|
* Maintained 1996-1997 Andreas Dilger
|
||||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* Written 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
*
|
||||||
* To the extent possible under law, the authors have waived
|
* To the extent possible under law, the authors have waived
|
||||||
* all copyright and related or neighboring rights to this file.
|
* all copyright and related or neighboring rights to this file.
|
||||||
* This work is published from: United States.
|
* This work is published from: United States, Canada.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This is an example of how to use libpng to read and write PNG files.
|
/* This is an example of how to use libpng to read and write PNG files.
|
||||||
* The file libpng-manual.txt is much more verbose then this. If you have not
|
* The file libpng-manual.txt is much more verbose then this. If you have
|
||||||
* read it, do so first. This was designed to be a starting point of an
|
* not read it, do so first. This was designed to be a starting point of an
|
||||||
* implementation. This is not officially part of libpng, is hereby placed
|
* implementation. This is not officially part of libpng, is hereby placed
|
||||||
* in the public domain, and therefore does not require a copyright notice.
|
* in the public domain, and therefore does not require a copyright notice.
|
||||||
*
|
*
|
||||||
|
@ -24,16 +26,17 @@
|
||||||
* see also the programs in the contrib directory.
|
* see also the programs in the contrib directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The simple, but restricted, approach to reading a PNG file or data stream
|
/* The simple, but restricted approach to reading a PNG file or data stream
|
||||||
* just requires two function calls, as in the following complete program.
|
* requires just two function calls, as in the following complete program.
|
||||||
* Writing a file just needs one function call, so long as the data has an
|
* Writing a file needs just one function call, so long as the data has an
|
||||||
* appropriate layout.
|
* appropriate layout.
|
||||||
*
|
*
|
||||||
* The following code reads PNG image data from a file and writes it, in a
|
* The following code reads PNG image data from a file and writes it, in a
|
||||||
* potentially new format, to a new file. While this code will compile there is
|
* potentially new format, to a new file. While this code will compile, there
|
||||||
* minimal (insufficient) error checking; for a more realistic version look at
|
* is minimal (insufficient) error checking. For a more realistic version,
|
||||||
* contrib/examples/pngtopng.c
|
* see contrib/examples/pngtopng.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -68,28 +71,28 @@ int main(int argc, const char **argv)
|
||||||
*/
|
*/
|
||||||
buffer = malloc(PNG_IMAGE_SIZE(image));
|
buffer = malloc(PNG_IMAGE_SIZE(image));
|
||||||
|
|
||||||
/* If enough memory was available read the image in the desired format
|
/* If enough memory was available, read the image in the desired
|
||||||
* then write the result out to the new file. 'background' is not
|
* format, then write the result out to the new file. 'background' is
|
||||||
* necessary when reading the image because the alpha channel is
|
* not necessary when reading the image, because the alpha channel is
|
||||||
* preserved; if it were to be removed, for example if we requested
|
* preserved; if it were to be removed, for example if we requested
|
||||||
* PNG_FORMAT_RGB, then either a solid background color would have to
|
* PNG_FORMAT_RGB, then either a solid background color would have to
|
||||||
* be supplied or the output buffer would have to be initialized to the
|
* be supplied, or the output buffer would have to be initialized to
|
||||||
* actual background of the image.
|
* the actual background of the image.
|
||||||
*
|
*
|
||||||
* The fourth argument to png_image_finish_read is the 'row_stride' -
|
* The fourth argument to png_image_finish_read is the 'row_stride' -
|
||||||
* this is the number of components allocated for the image in each
|
* this is the number of components allocated for the image in each
|
||||||
* row. It has to be at least as big as the value returned by
|
* row. It has to be at least as big as the value returned by
|
||||||
* PNG_IMAGE_ROW_STRIDE, but if you just allocate space for the
|
* PNG_IMAGE_ROW_STRIDE, but if you just allocate space for the
|
||||||
* default, minimum, size using PNG_IMAGE_SIZE as above you can pass
|
* default, minimum size, using PNG_IMAGE_SIZE as above, you can pass
|
||||||
* zero.
|
* zero.
|
||||||
*
|
*
|
||||||
* The final argument is a pointer to a buffer for the colormap;
|
* The final argument is a pointer to a buffer for the colormap;
|
||||||
* colormaps have exactly the same format as a row of image pixels (so
|
* colormaps have exactly the same format as a row of image pixels
|
||||||
* you choose what format to make the colormap by setting
|
* (so you choose what format to make the colormap by setting
|
||||||
* image.format). A colormap is only returned if
|
* image.format). A colormap is only returned if
|
||||||
* PNG_FORMAT_FLAG_COLORMAP is also set in image.format, so in this
|
* PNG_FORMAT_FLAG_COLORMAP is also set in image.format, so in this
|
||||||
* case NULL is passed as the final argument. If you do want to force
|
* case NULL is passed as the final argument. If you do want to force
|
||||||
* all images into an index/color-mapped format then you can use:
|
* all images into an index/color-mapped format, then you can use:
|
||||||
*
|
*
|
||||||
* PNG_IMAGE_COLORMAP_SIZE(image)
|
* PNG_IMAGE_COLORMAP_SIZE(image)
|
||||||
*
|
*
|
||||||
|
@ -111,17 +114,15 @@ int main(int argc, const char **argv)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Calling png_image_free is optional unless the simplified API was
|
/* Calling png_image_free is optional unless the simplified API was
|
||||||
* not run to completion. In this case if there wasn't enough
|
* not run to completion. In this case, if there wasn't enough
|
||||||
* memory for 'buffer' we didn't complete the read, so we must free
|
* memory for 'buffer', we didn't complete the read, so we must
|
||||||
* the image:
|
* free the image:
|
||||||
*/
|
*/
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
png_image_free(&image);
|
png_image_free(&image);
|
||||||
|
|
||||||
else
|
else
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
@ -134,61 +135,63 @@ int main(int argc, const char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n");
|
fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n");
|
||||||
exit(1);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* That's it ;-) Of course you probably want to do more with PNG files than
|
/* That's it ;-) Of course you probably want to do more with PNG files than
|
||||||
* just converting them all to 32-bit RGBA PNG files; you can do that between
|
* just converting them all to 32-bit RGBA PNG files; you can do that between
|
||||||
* the call to png_image_finish_read and png_image_write_to_file. You can also
|
* the call to png_image_finish_read and png_image_write_to_file. You can also
|
||||||
* ask for the image data to be presented in a number of different formats. You
|
* ask for the image data to be presented in a number of different formats.
|
||||||
* do this by simply changing the 'format' parameter set before allocating the
|
* You do this by simply changing the 'format' parameter set before allocating
|
||||||
* buffer.
|
* the buffer.
|
||||||
*
|
*
|
||||||
* The format parameter consists of five flags that define various aspects of
|
* The format parameter consists of five flags that define various aspects of
|
||||||
* the image, you can simply add these together to get the format or you can use
|
* the image. You can simply add these together to get the format, or you can
|
||||||
* one of the predefined macros from png.h (as above):
|
* use one of the predefined macros from png.h (as above):
|
||||||
*
|
*
|
||||||
* PNG_FORMAT_FLAG_COLOR: if set the image will have three color components per
|
* PNG_FORMAT_FLAG_COLOR: if set, the image will have three color components
|
||||||
* pixel (red, green and blue), if not set the image will just have one
|
* per pixel (red, green and blue); if not set, the image will just have one
|
||||||
* luminance (grayscale) component.
|
* luminance (grayscale) component.
|
||||||
*
|
*
|
||||||
* PNG_FORMAT_FLAG_ALPHA: if set each pixel in the image will have an additional
|
* PNG_FORMAT_FLAG_ALPHA: if set, each pixel in the image will have an
|
||||||
* alpha value; a linear value that describes the degree the image pixel
|
* additional alpha value; a linear value that describes the degree the
|
||||||
* covers (overwrites) the contents of the existing pixel on the display.
|
* image pixel covers (overwrites) the contents of the existing pixel on the
|
||||||
|
* display.
|
||||||
*
|
*
|
||||||
* PNG_FORMAT_FLAG_LINEAR: if set the components of each pixel will be returned
|
* PNG_FORMAT_FLAG_LINEAR: if set, the components of each pixel will be
|
||||||
* as a series of 16-bit linear values, if not set the components will be
|
* returned as a series of 16-bit linear values; if not set, the components
|
||||||
* returned as a series of 8-bit values encoded according to the 'sRGB'
|
* will be returned as a series of 8-bit values encoded according to the
|
||||||
* standard. The 8-bit format is the normal format for images intended for
|
* sRGB standard. The 8-bit format is the normal format for images intended
|
||||||
* direct display, because almost all display devices do the inverse of the
|
* for direct display, because almost all display devices do the inverse of
|
||||||
* sRGB transformation to the data they receive. The 16-bit format is more
|
* the sRGB transformation to the data they receive. The 16-bit format is
|
||||||
* common for scientific data and image data that must be further processed;
|
* more common for scientific data and image data that must be further
|
||||||
* because it is linear simple math can be done on the component values.
|
* processed; because it is linear, simple math can be done on the component
|
||||||
* Regardless of the setting of this flag the alpha channel is always linear,
|
* values. Regardless of the setting of this flag, the alpha channel is
|
||||||
* although it will be 8 bits or 16 bits wide as specified by the flag.
|
* always linear, although it will be 8 bits or 16 bits wide as specified by
|
||||||
|
* the flag.
|
||||||
*
|
*
|
||||||
* PNG_FORMAT_FLAG_BGR: if set the components of a color pixel will be returned
|
* PNG_FORMAT_FLAG_BGR: if set, the components of a color pixel will be
|
||||||
* in the order blue, then green, then red. If not set the pixel components
|
* returned in the order blue, then green, then red. If not set, the pixel
|
||||||
* are in the order red, then green, then blue.
|
* components are in the order red, then green, then blue.
|
||||||
*
|
*
|
||||||
* PNG_FORMAT_FLAG_AFIRST: if set the alpha channel (if present) precedes the
|
* PNG_FORMAT_FLAG_AFIRST: if set, the alpha channel (if present) precedes the
|
||||||
* color or grayscale components. If not set the alpha channel follows the
|
* color or grayscale components. If not set, the alpha channel follows the
|
||||||
* components.
|
* components.
|
||||||
*
|
*
|
||||||
* You do not have to read directly from a file. You can read from memory or,
|
* You do not have to read directly from a file. You can read from memory or,
|
||||||
* on systems that support it, from a <stdio.h> FILE*. This is controlled by
|
* on systems that support it, from a <stdio.h> FILE*. This is controlled by
|
||||||
* the particular png_image_read_from_ function you call at the start. Likewise
|
* the particular png_image_read_from_ function you call at the start.
|
||||||
* on write you can write to a FILE* if your system supports it. Check the
|
* Likewise, on write, you can write to a FILE* if your system supports it.
|
||||||
* macro PNG_STDIO_SUPPORTED to see if stdio support has been included in your
|
* Check the macro PNG_STDIO_SUPPORTED to see if stdio support has been
|
||||||
* libpng build.
|
* included in your libpng build.
|
||||||
*
|
*
|
||||||
* If you read 16-bit (PNG_FORMAT_FLAG_LINEAR) data you may need to write it in
|
* If you read 16-bit (PNG_FORMAT_FLAG_LINEAR) data, you may need to write it
|
||||||
* the 8-bit format for display. You do this by setting the convert_to_8bit
|
* in the 8-bit format for display. You do this by setting the convert_to_8bit
|
||||||
* flag to 'true'.
|
* flag to 'true'.
|
||||||
*
|
*
|
||||||
* Don't repeatedly convert between the 8-bit and 16-bit forms. There is
|
* Don't repeatedly convert between the 8-bit and 16-bit forms. There is
|
||||||
* significant data loss when 16-bit data is converted to the 8-bit encoding and
|
* significant data loss when 16-bit data is converted to the 8-bit encoding,
|
||||||
* the current libpng implementation of conversion to 16-bit is also
|
* and the current libpng implementation of conversion to 16-bit is also
|
||||||
* significantly lossy. The latter will be fixed in the future, but the former
|
* significantly lossy. The latter will be fixed in the future, but the former
|
||||||
* is unavoidable - the 8-bit format just doesn't have enough resolution.
|
* is unavoidable - the 8-bit format just doesn't have enough resolution.
|
||||||
*/
|
*/
|
||||||
|
@ -199,10 +202,10 @@ int main(int argc, const char **argv)
|
||||||
* interfaces.
|
* interfaces.
|
||||||
*
|
*
|
||||||
* All these interfaces require that you do your own error handling - your
|
* All these interfaces require that you do your own error handling - your
|
||||||
* program must be able to arrange for control to return to your own code any
|
* program must be able to arrange for control to return to your own code, any
|
||||||
* time libpng encounters a problem. There are several ways to do this, but the
|
* time libpng encounters a problem. There are several ways to do this, but
|
||||||
* standard way is to use the ANSI-C (C90) <setjmp.h> interface to establish a
|
* the standard way is to use the <setjmp.h> interface to establish a return
|
||||||
* return point within your own code. You must do this if you do not use the
|
* point within your own code. You must do this if you do not use the
|
||||||
* simplified interface (above).
|
* simplified interface (above).
|
||||||
*
|
*
|
||||||
* The first step is to include the header files you need, including the libpng
|
* The first step is to include the header files you need, including the libpng
|
||||||
|
@ -214,7 +217,7 @@ int main(int argc, const char **argv)
|
||||||
/* The png_jmpbuf() macro, used in error handling, became available in
|
/* The png_jmpbuf() macro, used in error handling, became available in
|
||||||
* libpng version 1.0.6. If you want to be able to run your code with older
|
* libpng version 1.0.6. If you want to be able to run your code with older
|
||||||
* versions of libpng, you must define the macro yourself (but only if it
|
* versions of libpng, you must define the macro yourself (but only if it
|
||||||
* is not already defined by libpng!).
|
* is not already defined by libpng!)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef png_jmpbuf
|
#ifndef png_jmpbuf
|
||||||
|
@ -222,10 +225,10 @@ int main(int argc, const char **argv)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
||||||
* returns zero if the image is a PNG and nonzero if it isn't a PNG.
|
* returns zero if the image is a PNG, and nonzero otherwise.
|
||||||
*
|
*
|
||||||
* The function check_if_png() shown here, but not used, returns nonzero (true)
|
* The function check_if_png() shown here, but not used, returns nonzero (true)
|
||||||
* if the file can be opened and is a PNG, 0 (false) otherwise.
|
* if the file can be opened and is a PNG, and 0 (false) otherwise.
|
||||||
*
|
*
|
||||||
* If this call is successful, and you are going to keep the file open,
|
* If this call is successful, and you are going to keep the file open,
|
||||||
* you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once
|
* you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once
|
||||||
|
@ -238,7 +241,7 @@ int main(int argc, const char **argv)
|
||||||
*
|
*
|
||||||
* Many applications already read the first 2 or 4 bytes from the start
|
* Many applications already read the first 2 or 4 bytes from the start
|
||||||
* of the image to determine the file type, so it would be easiest just
|
* of the image to determine the file type, so it would be easiest just
|
||||||
* to pass the bytes to png_sig_cmp() or even skip that if you know
|
* to pass the bytes to png_sig_cmp(), or even skip that if you know
|
||||||
* you have a PNG file, and call png_set_sig_bytes().
|
* you have a PNG file, and call png_set_sig_bytes().
|
||||||
*/
|
*/
|
||||||
#define PNG_BYTES_TO_CHECK 4
|
#define PNG_BYTES_TO_CHECK 4
|
||||||
|
@ -250,14 +253,14 @@ int check_if_png(char *file_name, FILE **fp)
|
||||||
if ((*fp = fopen(file_name, "rb")) == NULL)
|
if ((*fp = fopen(file_name, "rb")) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Read in some of the signature bytes */
|
/* Read in some of the signature bytes. */
|
||||||
if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK)
|
if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Compare the first PNG_BYTES_TO_CHECK bytes of the signature.
|
/* Compare the first PNG_BYTES_TO_CHECK bytes of the signature.
|
||||||
Return nonzero (true) if they match */
|
* Return nonzero (true) if they match.
|
||||||
|
*/
|
||||||
return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK));
|
return(!png_sig_cmp(buf, 0, PNG_BYTES_TO_CHECK));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a PNG file. You may want to return an error code if the read
|
/* Read a PNG file. You may want to return an error code if the read
|
||||||
|
@ -292,7 +295,7 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
* functions. If you want to use the default stderr and longjump method,
|
* functions. If you want to use the default stderr and longjump method,
|
||||||
* you can supply NULL for the last three parameters. We also supply the
|
* you can supply NULL for the last three parameters. We also supply the
|
||||||
* the compiler header file version, so that we know if the application
|
* the compiler header file version, so that we know if the application
|
||||||
* was compiled with a compatible version of the library. REQUIRED
|
* was compiled with a compatible version of the library. REQUIRED.
|
||||||
*/
|
*/
|
||||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||||
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
||||||
|
@ -316,35 +319,33 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
* the normal method of doing things with libpng). REQUIRED unless you
|
* the normal method of doing things with libpng). REQUIRED unless you
|
||||||
* set up your own error handlers in the png_create_read_struct() earlier.
|
* set up your own error handlers in the png_create_read_struct() earlier.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
/* Free all of the memory associated with the png_ptr and info_ptr */
|
/* Free all of the memory associated with the png_ptr and info_ptr. */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
/* If we get here, we had a problem reading the file */
|
/* If we get here, we had a problem reading the file. */
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One of the following I/O initialization methods is REQUIRED */
|
/* One of the following I/O initialization methods is REQUIRED. */
|
||||||
#ifdef streams /* PNG file I/O method 1 */
|
#ifdef streams /* PNG file I/O method 1 */
|
||||||
/* Set up the input control if you are using standard C streams */
|
/* Set up the input control if you are using standard C streams. */
|
||||||
png_init_io(png_ptr, fp);
|
png_init_io(png_ptr, fp);
|
||||||
|
|
||||||
#else no_streams /* PNG file I/O method 2 */
|
#else no_streams /* PNG file I/O method 2 */
|
||||||
/* If you are using replacement read functions, instead of calling
|
/* If you are using replacement read functions, instead of calling
|
||||||
* png_init_io() here you would call:
|
* png_init_io(), you would call:
|
||||||
*/
|
*/
|
||||||
png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn);
|
png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn);
|
||||||
/* where user_io_ptr is a structure you want available to the callbacks */
|
/* where user_io_ptr is a structure you want available to the callbacks. */
|
||||||
#endif no_streams /* Use only one I/O method! */
|
#endif no_streams /* Use only one I/O method! */
|
||||||
|
|
||||||
/* If we have already read some of the signature */
|
/* If we have already read some of the signature */
|
||||||
png_set_sig_bytes(png_ptr, sig_read);
|
png_set_sig_bytes(png_ptr, sig_read);
|
||||||
|
|
||||||
#ifdef hilevel
|
#ifdef hilevel
|
||||||
/*
|
/* If you have enough memory to read in the entire image at once,
|
||||||
* If you have enough memory to read in the entire image at once,
|
|
||||||
* and you need to specify only transforms that can be controlled
|
* and you need to specify only transforms that can be controlled
|
||||||
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
||||||
* quantizing, filling, setting background, and doing gamma
|
* quantizing, filling, setting background, and doing gamma
|
||||||
|
@ -354,10 +355,10 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
|
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* OK, you're doing it the hard way, with the lower-level functions */
|
/* OK, you're doing it the hard way, with the lower-level functions. */
|
||||||
|
|
||||||
/* The call to png_read_info() gives us all of the information from the
|
/* The call to png_read_info() gives us all of the information from the
|
||||||
* PNG file before the first IDAT (image data chunk). REQUIRED
|
* PNG file before the first IDAT (image data chunk). REQUIRED.
|
||||||
*/
|
*/
|
||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
@ -385,20 +386,21 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
*/
|
*/
|
||||||
png_set_strip_alpha(png_ptr);
|
png_set_strip_alpha(png_ptr);
|
||||||
|
|
||||||
/* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
|
/* Extract multiple pixels with bit depths of 1, 2 or 4 from a single
|
||||||
* byte into separate bytes (useful for paletted and grayscale images).
|
* byte into separate bytes (useful for paletted and grayscale images).
|
||||||
*/
|
*/
|
||||||
png_set_packing(png_ptr);
|
png_set_packing(png_ptr);
|
||||||
|
|
||||||
/* Change the order of packed pixels to least significant bit first
|
/* Change the order of packed pixels to least significant bit first
|
||||||
* (not useful if you are using png_set_packing). */
|
* (not useful if you are using png_set_packing).
|
||||||
|
*/
|
||||||
png_set_packswap(png_ptr);
|
png_set_packswap(png_ptr);
|
||||||
|
|
||||||
/* Expand paletted colors into true RGB triplets */
|
/* Expand paletted colors into true RGB triplets. */
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_palette_to_rgb(png_ptr);
|
png_set_palette_to_rgb(png_ptr);
|
||||||
|
|
||||||
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
|
/* Expand grayscale images to the full 8 bits from 1, 2 or 4 bits/pixel. */
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||||
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
png_set_expand_gray_1_2_4_to_8(png_ptr);
|
||||||
|
|
||||||
|
@ -409,12 +411,11 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
png_set_tRNS_to_alpha(png_ptr);
|
png_set_tRNS_to_alpha(png_ptr);
|
||||||
|
|
||||||
/* Set the background color to draw transparent and alpha images over.
|
/* Set the background color to draw transparent and alpha images over.
|
||||||
* It is possible to set the red, green, and blue components directly
|
* It is possible to set the red, green and blue components directly
|
||||||
* for paletted images instead of supplying a palette index. Note that
|
* for paletted images, instead of supplying a palette index. Note that,
|
||||||
* even if the PNG file supplies a background, you are not required to
|
* even if the PNG file supplies a background, you are not required to
|
||||||
* use it - you should use the (solid) application background if it has one.
|
* use it - you should use the (solid) application background if it has one.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
png_color_16 my_background, *image_background;
|
png_color_16 my_background, *image_background;
|
||||||
|
|
||||||
if (png_get_bKGD(png_ptr, info_ptr, &image_background) != 0)
|
if (png_get_bKGD(png_ptr, info_ptr, &image_background) != 0)
|
||||||
|
@ -424,32 +425,29 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
png_set_background(png_ptr, &my_background,
|
png_set_background(png_ptr, &my_background,
|
||||||
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
|
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
|
||||||
|
|
||||||
/* Some suggestions as to how to get a screen gamma value
|
/* Some suggestions as to how to get a screen gamma value.
|
||||||
*
|
*
|
||||||
* Note that screen gamma is the display_exponent, which includes
|
* Note that screen gamma is the display_exponent, which includes
|
||||||
* the CRT_exponent and any correction for viewing conditions
|
* the CRT_exponent and any correction for viewing conditions.
|
||||||
*/
|
*/
|
||||||
if (/* We have a user-defined screen gamma value */)
|
if (/* We have a user-defined screen gamma value */)
|
||||||
{
|
|
||||||
screen_gamma = user-defined screen_gamma;
|
screen_gamma = user-defined screen_gamma;
|
||||||
}
|
/* This is one way that applications share the same screen gamma value. */
|
||||||
/* This is one way that applications share the same screen gamma value */
|
|
||||||
else if ((gamma_str = getenv("SCREEN_GAMMA")) != NULL)
|
else if ((gamma_str = getenv("SCREEN_GAMMA")) != NULL)
|
||||||
{
|
|
||||||
screen_gamma = atof(gamma_str);
|
screen_gamma = atof(gamma_str);
|
||||||
}
|
|
||||||
/* If we don't have another value */
|
/* If we don't have another value */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor
|
screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor
|
||||||
in a dimly lit room */
|
in a dimly lit room */
|
||||||
screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac systems */
|
screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac
|
||||||
|
systems */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell libpng to handle the gamma conversion for you. The final call
|
/* Tell libpng to handle the gamma conversion for you. The final call
|
||||||
* is a good guess for PC generated images, but it should be configurable
|
* is a good guess for PC generated images, but it should be configurable
|
||||||
* by the user at run time by the user. It is strongly suggested that
|
* by the user at run time. Gamma correction support in your application
|
||||||
* your application support gamma correction.
|
* is strongly recommended.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int intent;
|
int intent;
|
||||||
|
@ -466,7 +464,7 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
/* Quantize RGB files down to 8-bit palette or reduce palettes
|
/* Quantize RGB files down to 8-bit palette, or reduce palettes
|
||||||
* to the number of colors available on your screen.
|
* to the number of colors available on your screen.
|
||||||
*/
|
*/
|
||||||
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
|
@ -474,29 +472,26 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
int num_palette;
|
int num_palette;
|
||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
|
|
||||||
/* This reduces the image to the application supplied palette */
|
/* This reduces the image to the application-supplied palette. */
|
||||||
if (/* We have our own palette */)
|
if (/* We have our own palette */)
|
||||||
{
|
{
|
||||||
/* An array of colors to which the image should be quantized */
|
/* An array of colors to which the image should be quantized. */
|
||||||
png_color std_color_cube[MAX_SCREEN_COLORS];
|
png_color std_color_cube[MAX_SCREEN_COLORS];
|
||||||
|
|
||||||
png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
||||||
MAX_SCREEN_COLORS, NULL, 0);
|
MAX_SCREEN_COLORS, NULL, 0);
|
||||||
}
|
}
|
||||||
/* This reduces the image to the palette supplied in the file */
|
/* This reduces the image to the palette supplied in the file. */
|
||||||
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) != 0)
|
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) != 0)
|
||||||
{
|
{
|
||||||
png_uint_16p histogram = NULL;
|
png_uint_16p histogram = NULL;
|
||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr, &histogram);
|
png_get_hIST(png_ptr, info_ptr, &histogram);
|
||||||
|
|
||||||
png_set_quantize(png_ptr, palette, num_palette,
|
png_set_quantize(png_ptr, palette, num_palette,
|
||||||
max_screen_colors, histogram, 0);
|
max_screen_colors, histogram, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* READ_QUANTIZE */
|
#endif /* READ_QUANTIZE */
|
||||||
|
|
||||||
/* Invert monochrome files to have 0 as white and 1 as black */
|
/* Invert monochrome files to have 0 as white and 1 as black. */
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
/* If you want to shift the pixel values from the range [0,255] or
|
/* If you want to shift the pixel values from the range [0,255] or
|
||||||
|
@ -506,22 +501,21 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT) != 0)
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT) != 0)
|
||||||
{
|
{
|
||||||
png_color_8p sig_bit_p;
|
png_color_8p sig_bit_p;
|
||||||
|
|
||||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
|
png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
|
||||||
png_set_shift(png_ptr, sig_bit_p);
|
png_set_shift(png_ptr, sig_bit_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flip the RGB pixels to BGR (or RGBA to BGRA) */
|
/* Flip the RGB pixels to BGR (or RGBA to BGRA). */
|
||||||
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR). */
|
||||||
png_set_swap_alpha(png_ptr);
|
png_set_swap_alpha(png_ptr);
|
||||||
|
|
||||||
/* Swap bytes of 16-bit files to least significant byte first */
|
/* Swap bytes of 16-bit files to least significant byte first. */
|
||||||
png_set_swap(png_ptr);
|
png_set_swap(png_ptr);
|
||||||
|
|
||||||
/* Add filler (or alpha) byte (before/after each RGB triplet) */
|
/* Add filler (or alpha) byte (before/after each RGB triplet). */
|
||||||
png_set_filler(png_ptr, 0xffff, PNG_FILLER_AFTER);
|
png_set_filler(png_ptr, 0xffff, PNG_FILLER_AFTER);
|
||||||
|
|
||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
|
@ -534,40 +528,31 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
number_passes = 1;
|
number_passes = 1;
|
||||||
#endif /* READ_INTERLACING */
|
#endif /* READ_INTERLACING */
|
||||||
|
|
||||||
|
|
||||||
/* Optional call to gamma correct and add the background to the palette
|
/* Optional call to gamma correct and add the background to the palette
|
||||||
* and update info structure. REQUIRED if you are expecting libpng to
|
* and update info structure. REQUIRED if you are expecting libpng to
|
||||||
* update the palette for you (ie you selected such a transform above).
|
* update the palette for you (i.e. you selected such a transform above).
|
||||||
*/
|
*/
|
||||||
png_read_update_info(png_ptr, info_ptr);
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
/* Allocate the memory to hold the image using the fields of info_ptr. */
|
/* Allocate the memory to hold the image using the fields of info_ptr. */
|
||||||
|
|
||||||
/* The easiest way to read the image: */
|
|
||||||
png_bytep row_pointers[height];
|
png_bytep row_pointers[height];
|
||||||
|
|
||||||
/* Clear the pointer array */
|
|
||||||
for (row = 0; row < height; row++)
|
for (row = 0; row < height; row++)
|
||||||
row_pointers[row] = NULL;
|
row_pointers[row] = NULL; /* Clear the pointer array */
|
||||||
|
|
||||||
for (row = 0; row < height; row++)
|
for (row = 0; row < height; row++)
|
||||||
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||||
info_ptr));
|
info_ptr));
|
||||||
|
|
||||||
/* Now it's time to read the image. One of these methods is REQUIRED */
|
/* Now it's time to read the image. One of these methods is REQUIRED. */
|
||||||
#ifdef entire /* Read the entire image in one go */
|
#ifdef entire /* Read the entire image in one go */
|
||||||
png_read_image(png_ptr, row_pointers);
|
png_read_image(png_ptr, row_pointers);
|
||||||
|
|
||||||
#else no_entire /* Read the image one or more scanlines at a time */
|
#else no_entire /* Read the image one or more scanlines at a time */
|
||||||
/* The other way to read images - deal with interlacing: */
|
/* The other way to read images - deal with interlacing: */
|
||||||
|
|
||||||
for (pass = 0; pass < number_passes; pass++)
|
for (pass = 0; pass < number_passes; pass++)
|
||||||
{
|
{
|
||||||
#ifdef single /* Read the image a single row at a time */
|
#ifdef single /* Read the image a single row at a time */
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
|
||||||
png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
|
png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
|
||||||
}
|
|
||||||
|
|
||||||
#else no_single /* Read the image several rows at a time */
|
#else no_single /* Read the image several rows at a time */
|
||||||
for (y = 0; y < height; y += number_of_rows)
|
for (y = 0; y < height; y += number_of_rows)
|
||||||
|
@ -581,24 +566,24 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||||
#endif no_sparkle /* Use only one of these two methods */
|
#endif no_sparkle /* Use only one of these two methods */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If you want to display the image after every pass, do so here */
|
/* If you want to display the image after every pass, do so here. */
|
||||||
#endif no_single /* Use only one of these two methods */
|
#endif no_single /* Use only one of these two methods */
|
||||||
}
|
}
|
||||||
#endif no_entire /* Use only one of these two methods */
|
#endif no_entire /* Use only one of these two methods */
|
||||||
|
|
||||||
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
/* Read rest of file, and get additional chunks in info_ptr. REQUIRED. */
|
||||||
png_read_end(png_ptr, info_ptr);
|
png_read_end(png_ptr, info_ptr);
|
||||||
#endif hilevel
|
#endif hilevel
|
||||||
|
|
||||||
/* At this point you have read the entire image */
|
/* At this point you have read the entire image. */
|
||||||
|
|
||||||
/* Clean up after the read, and free any memory allocated - REQUIRED */
|
/* Clean up after the read, and free any memory allocated. REQUIRED. */
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
|
|
||||||
/* Close the file */
|
/* Close the file. */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* That's it */
|
/* That's it! */
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,34 +595,30 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
||||||
/* Create and initialize the png_struct with the desired error handler
|
/* Create and initialize the png_struct with the desired error handler
|
||||||
* functions. If you want to use the default stderr and longjump method,
|
* functions. If you want to use the default stderr and longjump method,
|
||||||
* you can supply NULL for the last three parameters. We also check that
|
* you can supply NULL for the last three parameters. We also check that
|
||||||
* the library version is compatible in case we are using dynamically
|
* the library version is compatible, in case we are using dynamically
|
||||||
* linked libraries.
|
* linked libraries.
|
||||||
*/
|
*/
|
||||||
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||||
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
||||||
|
|
||||||
if (*png_ptr == NULL)
|
if (*png_ptr == NULL)
|
||||||
{
|
{
|
||||||
*info_ptr = NULL;
|
*info_ptr = NULL;
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
*info_ptr = png_create_info_struct(png_ptr);
|
*info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
|
||||||
if (*info_ptr == NULL)
|
if (*info_ptr == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This one's new. You will need to provide all three
|
/* You will need to provide all three function callbacks,
|
||||||
* function callbacks, even if you aren't using them all.
|
* even if you aren't using all of them.
|
||||||
* If you aren't using all functions, you can specify NULL
|
* If you aren't using all functions, you can specify NULL
|
||||||
* parameters. Even when all three functions are NULL,
|
* parameters. Even when all three functions are NULL,
|
||||||
* you need to call png_set_progressive_read_fn().
|
* you need to call png_set_progressive_read_fn().
|
||||||
|
@ -650,7 +631,6 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
||||||
*/
|
*/
|
||||||
png_set_progressive_read_fn(*png_ptr, (void *)stream_data,
|
png_set_progressive_read_fn(*png_ptr, (void *)stream_data,
|
||||||
info_callback, row_callback, end_callback);
|
info_callback, row_callback, end_callback);
|
||||||
|
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,18 +640,18 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
|
||||||
{
|
{
|
||||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
/* Free the png_ptr and info_ptr memory on error */
|
/* Free the png_ptr and info_ptr memory on error. */
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This one's new also. Simply give it chunks of data as
|
/* Give chunks of data as they arrive from the data stream
|
||||||
* they arrive from the data stream (in order, of course).
|
* (in order, of course).
|
||||||
* On segmented machines, don't give it any more than 64K.
|
* On segmented machines, don't give it any more than 64K.
|
||||||
* The library seems to run fine with sizes of 4K, although
|
* The library seems to run fine with sizes of 4K, although
|
||||||
* you can give it much less if necessary (I assume you can
|
* you can give it much less if necessary. (I assume you can
|
||||||
* give it chunks of 1 byte, but I haven't tried with less
|
* give it chunks of 1 byte, but I haven't tried with less
|
||||||
* than 256 bytes yet). When this function returns, you may
|
* than 256 bytes yet.) When this function returns, you may
|
||||||
* want to display any rows that were generated in the row
|
* want to display any rows that were generated in the row
|
||||||
* callback, if you aren't already displaying them there.
|
* callback, if you aren't already displaying them there.
|
||||||
*/
|
*/
|
||||||
|
@ -693,8 +673,7 @@ info_callback(png_structp png_ptr, png_infop info)
|
||||||
row_callback(png_structp png_ptr, png_bytep new_row,
|
row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
png_uint_32 row_num, int pass)
|
png_uint_32 row_num, int pass)
|
||||||
{
|
{
|
||||||
/*
|
/* This function is called for every row in the image. If the
|
||||||
* This function is called for every row in the image. If the
|
|
||||||
* image is interlaced, and you turned on the interlace handler,
|
* image is interlaced, and you turned on the interlace handler,
|
||||||
* this function will be called for every row in every pass.
|
* this function will be called for every row in every pass.
|
||||||
*
|
*
|
||||||
|
@ -705,25 +684,22 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
* The new row data pointer "new_row" may be NULL, indicating there is
|
* The new row data pointer "new_row" may be NULL, indicating there is
|
||||||
* no new data to be replaced (in cases of interlace loading).
|
* no new data to be replaced (in cases of interlace loading).
|
||||||
*
|
*
|
||||||
* If new_row is not NULL then you need to call
|
* If new_row is not NULL, then you need to call
|
||||||
* png_progressive_combine_row() to replace the corresponding row as
|
* png_progressive_combine_row(), to replace the corresponding row as
|
||||||
* shown below:
|
* shown below:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Get pointer to corresponding row in our
|
/* Get pointer to corresponding row in our PNG read buffer. */
|
||||||
* PNG read buffer.
|
|
||||||
*/
|
|
||||||
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
||||||
|
|
||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
/* If both rows are allocated then copy the new row
|
/* If both rows are allocated, then copy the new row
|
||||||
* data to the corresponding row data.
|
* data to the corresponding row data.
|
||||||
*/
|
*/
|
||||||
if ((old_row != NULL) && (new_row != NULL))
|
if (old_row != NULL && new_row != NULL)
|
||||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
|
|
||||||
/*
|
/* The rows and passes are called in order, so you don't really
|
||||||
* The rows and passes are called in order, so you don't really
|
|
||||||
* need the row_num and pass, but I'm supplying them because it
|
* need the row_num and pass, but I'm supplying them because it
|
||||||
* may make your life easier.
|
* may make your life easier.
|
||||||
*
|
*
|
||||||
|
@ -734,7 +710,6 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
* (it just does the memcpy for you) if it will make the code
|
* (it just does the memcpy for you) if it will make the code
|
||||||
* easier. Thus, you can just do this for all cases:
|
* easier. Thus, you can just do this for all cases:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
png_progressive_combine_row(png_ptr, old_row, new_row);
|
png_progressive_combine_row(png_ptr, old_row, new_row);
|
||||||
|
|
||||||
/* where old_row is what was displayed for previous rows. Note
|
/* where old_row is what was displayed for previous rows. Note
|
||||||
|
@ -781,14 +756,13 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
*/
|
*/
|
||||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||||
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
png_voidp user_error_ptr, user_error_fn, user_warning_fn);
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate/initialize the image information data. REQUIRED */
|
/* Allocate/initialize the image information data. REQUIRED. */
|
||||||
info_ptr = png_create_info_struct(png_ptr);
|
info_ptr = png_create_info_struct(png_ptr);
|
||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
|
@ -797,30 +771,30 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set error handling. REQUIRED if you aren't supplying your own
|
/* Set up error handling. REQUIRED if you aren't supplying your own
|
||||||
* error handling functions in the png_create_write_struct() call.
|
* error handling functions in the png_create_write_struct() call.
|
||||||
*/
|
*/
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
/* If we get here, we had a problem writing the file */
|
/* If we get here, we had a problem writing the file. */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One of the following I/O initialization functions is REQUIRED */
|
/* One of the following I/O initialization functions is REQUIRED. */
|
||||||
|
|
||||||
#ifdef streams /* I/O initialization method 1 */
|
#ifdef streams /* I/O initialization method 1 */
|
||||||
/* Set up the output control if you are using standard C streams */
|
/* Set up the output control if you are using standard C streams. */
|
||||||
png_init_io(png_ptr, fp);
|
png_init_io(png_ptr, fp);
|
||||||
|
|
||||||
#else no_streams /* I/O initialization method 2 */
|
#else no_streams /* I/O initialization method 2 */
|
||||||
/* If you are using replacement write functions, instead of calling
|
/* If you are using replacement write functions, instead of calling
|
||||||
* png_init_io() here you would call
|
* png_init_io(), you would call:
|
||||||
*/
|
*/
|
||||||
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
|
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
|
||||||
user_IO_flush_function);
|
user_IO_flush_function);
|
||||||
/* where user_io_ptr is a structure you want available to the callbacks */
|
/* where user_io_ptr is a structure you want available to the callbacks. */
|
||||||
#endif no_streams /* Only use one initialization method */
|
#endif no_streams /* Only use one initialization method */
|
||||||
|
|
||||||
#ifdef hilevel
|
#ifdef hilevel
|
||||||
|
@ -831,30 +805,32 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
|
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* This is the hard way */
|
/* This is the hard way. */
|
||||||
|
|
||||||
/* Set the image information here. Width and height are up to 2^31,
|
/* Set the image information here. Width and height are up to 2^31,
|
||||||
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
|
* bit_depth is one of 1, 2, 4, 8 or 16, but valid values also depend on
|
||||||
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
|
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
|
||||||
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
|
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
|
||||||
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
|
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
|
||||||
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
|
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
|
||||||
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED
|
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE.
|
||||||
|
* REQUIRED.
|
||||||
*/
|
*/
|
||||||
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???,
|
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth,
|
||||||
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
PNG_COLOR_TYPE_???, PNG_INTERLACE_????,
|
||||||
|
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
/* Set the palette if there is one. REQUIRED for indexed-color images */
|
/* Set the palette if there is one. REQUIRED for indexed-color images. */
|
||||||
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
palette = (png_colorp)png_malloc(png_ptr,
|
||||||
* (sizeof (png_color)));
|
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color)));
|
||||||
/* ... Set palette colors ... */
|
/* ... Set palette colors ... */
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
||||||
/* You must not free palette here, because png_set_PLTE only makes a link to
|
/* You must not free palette here, because png_set_PLTE only makes a link
|
||||||
* the palette that you malloced. Wait until you are about to destroy
|
* to the palette that you allocated. Wait until you are about to destroy
|
||||||
* the png structure.
|
* the png structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Optional significant bit (sBIT) chunk */
|
/* Optional significant bit (sBIT) chunk. */
|
||||||
png_color_8 sig_bit;
|
png_color_8 sig_bit;
|
||||||
|
|
||||||
/* If we are dealing with a grayscale image then */
|
/* If we are dealing with a grayscale image then */
|
||||||
|
@ -870,13 +846,12 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
|
|
||||||
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||||
|
|
||||||
|
|
||||||
/* Optional gamma chunk is strongly suggested if you have any guess
|
/* Optional gamma chunk is strongly suggested if you have any guess
|
||||||
* as to the correct gamma of the image.
|
* as to the correct gamma of the image.
|
||||||
*/
|
*/
|
||||||
png_set_gAMA(png_ptr, info_ptr, gamma);
|
png_set_gAMA(png_ptr, info_ptr, gamma);
|
||||||
|
|
||||||
/* Optionally write comments into the image */
|
/* Optionally write comments into the image. */
|
||||||
{
|
{
|
||||||
png_text text_ptr[3];
|
png_text text_ptr[3];
|
||||||
|
|
||||||
|
@ -910,14 +885,14 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
png_set_text(write_ptr, write_info_ptr, text_ptr, 3);
|
png_set_text(write_ptr, write_info_ptr, text_ptr, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
|
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs. */
|
||||||
|
|
||||||
/* Note that if sRGB is present the gAMA and cHRM chunks must be ignored
|
/* Note that if sRGB is present, the gAMA and cHRM chunks must be ignored
|
||||||
* on read and, if your application chooses to write them, they must
|
* on read and, if your application chooses to write them, they must
|
||||||
* be written in accordance with the sRGB profile
|
* be written in accordance with the sRGB profile.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Write the file header information. REQUIRED */
|
/* Write the file header information. REQUIRED. */
|
||||||
png_write_info(png_ptr, info_ptr);
|
png_write_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
/* If you want, you can write the info in two steps, in case you need to
|
/* If you want, you can write the info in two steps, in case you need to
|
||||||
|
@ -941,7 +916,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
* all optional. Only call them if you want them.
|
* all optional. Only call them if you want them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Invert monochrome pixels */
|
/* Invert monochrome pixels. */
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
|
||||||
/* Shift the pixels up to a legal bit depth and fill in
|
/* Shift the pixels up to a legal bit depth and fill in
|
||||||
|
@ -949,10 +924,10 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
*/
|
*/
|
||||||
png_set_shift(png_ptr, &sig_bit);
|
png_set_shift(png_ptr, &sig_bit);
|
||||||
|
|
||||||
/* Pack pixels into bytes */
|
/* Pack pixels into bytes. */
|
||||||
png_set_packing(png_ptr);
|
png_set_packing(png_ptr);
|
||||||
|
|
||||||
/* Swap location of alpha bytes from ARGB to RGBA */
|
/* Swap location of alpha bytes from ARGB to RGBA. */
|
||||||
png_set_swap_alpha(png_ptr);
|
png_set_swap_alpha(png_ptr);
|
||||||
|
|
||||||
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
|
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
|
||||||
|
@ -960,19 +935,18 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
*/
|
*/
|
||||||
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
||||||
|
|
||||||
/* Flip BGR pixels to RGB */
|
/* Flip BGR pixels to RGB. */
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
/* Swap bytes of 16-bit files to most significant byte first */
|
/* Swap bytes of 16-bit files to most significant byte first. */
|
||||||
png_set_swap(png_ptr);
|
png_set_swap(png_ptr);
|
||||||
|
|
||||||
/* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
|
/* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats. */
|
||||||
png_set_packswap(png_ptr);
|
png_set_packswap(png_ptr);
|
||||||
|
|
||||||
/* Turn on interlace handling if you are not using png_write_image() */
|
/* Turn on interlace handling if you are not using png_write_image(). */
|
||||||
if (interlacing != 0)
|
if (interlacing != 0)
|
||||||
number_passes = png_set_interlace_handling(png_ptr);
|
number_passes = png_set_interlace_handling(png_ptr);
|
||||||
|
|
||||||
else
|
else
|
||||||
number_passes = 1;
|
number_passes = 1;
|
||||||
|
|
||||||
|
@ -982,29 +956,28 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
*/
|
*/
|
||||||
png_uint_32 k, height, width;
|
png_uint_32 k, height, width;
|
||||||
|
|
||||||
/* In this example, "image" is a one-dimensional array of bytes */
|
/* In this example, "image" is a one-dimensional array of bytes. */
|
||||||
|
|
||||||
|
/* Guard against integer overflow. */
|
||||||
|
if (height > PNG_SIZE_MAX / (width * bytes_per_pixel))
|
||||||
|
png_error(png_ptr, "Image data buffer would be too large");
|
||||||
|
|
||||||
/* Guard against integer overflow */
|
|
||||||
if (height > PNG_SIZE_MAX/(width*bytes_per_pixel)) {
|
|
||||||
png_error(png_ptr, "Image_data buffer would be too large");
|
|
||||||
}
|
|
||||||
png_byte image[height * width * bytes_per_pixel];
|
png_byte image[height * width * bytes_per_pixel];
|
||||||
|
|
||||||
png_bytep row_pointers[height];
|
png_bytep row_pointers[height];
|
||||||
|
|
||||||
if (height > PNG_UINT_32_MAX / (sizeof (png_bytep)))
|
if (height > PNG_UINT_32_MAX / (sizeof (png_bytep)))
|
||||||
png_error(png_ptr, "Image is too tall to process in memory");
|
png_error(png_ptr, "Image is too tall to process in memory");
|
||||||
|
|
||||||
/* Set up pointers into your "image" byte array */
|
/* Set up pointers into your "image" byte array. */
|
||||||
for (k = 0; k < height; k++)
|
for (k = 0; k < height; k++)
|
||||||
row_pointers[k] = image + k * width * bytes_per_pixel;
|
row_pointers[k] = image + k * width * bytes_per_pixel;
|
||||||
|
|
||||||
/* One of the following output methods is REQUIRED */
|
/* One of the following output methods is REQUIRED. */
|
||||||
|
|
||||||
#ifdef entire /* Write out the entire image data in one call */
|
#ifdef entire /* Write out the entire image data in one call */
|
||||||
png_write_image(png_ptr, row_pointers);
|
png_write_image(png_ptr, row_pointers);
|
||||||
|
|
||||||
/* The other way to write the image - deal with interlacing */
|
/* The other way to write the image - deal with interlacing. */
|
||||||
|
|
||||||
#else no_entire /* Write out the image data by one or more scanlines */
|
#else no_entire /* Write out the image data by one or more scanlines */
|
||||||
|
|
||||||
|
@ -1016,27 +989,27 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
/* Write a few rows at a time. */
|
/* Write a few rows at a time. */
|
||||||
png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows);
|
png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows);
|
||||||
|
|
||||||
/* If you are only writing one row at a time, this works */
|
/* If you are only writing one row at a time, this works. */
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
png_write_rows(png_ptr, &row_pointers[y], 1);
|
png_write_rows(png_ptr, &row_pointers[y], 1);
|
||||||
}
|
}
|
||||||
#endif no_entire /* Use only one output method */
|
#endif no_entire /* Use only one output method */
|
||||||
|
|
||||||
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
||||||
* as well. Shouldn't be necessary in 1.2.0 and up as all the public
|
* as well. Shouldn't be necessary in 1.2.0 and up, as all the public
|
||||||
* chunks are supported and you can use png_set_unknown_chunks() to
|
* chunks are supported, and you can use png_set_unknown_chunks() to
|
||||||
* register unknown chunks into the info structure to be written out.
|
* register unknown chunks into the info structure to be written out.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* It is REQUIRED to call this to finish writing the rest of the file */
|
/* It is REQUIRED to call this to finish writing the rest of the file. */
|
||||||
png_write_end(png_ptr, info_ptr);
|
png_write_end(png_ptr, info_ptr);
|
||||||
#endif hilevel
|
#endif hilevel
|
||||||
|
|
||||||
/* If you png_malloced a palette, free it here (don't free info_ptr->palette,
|
/* If you png_malloced a palette, free it here.
|
||||||
* as recommended in versions 1.0.5m and earlier of this example; if
|
* (Don't free info_ptr->palette, as shown in versions 1.0.5m and earlier of
|
||||||
* libpng mallocs info_ptr->palette, libpng will free it). If you
|
* this example; if libpng mallocs info_ptr->palette, libpng will free it).
|
||||||
* allocated it with malloc() instead of png_malloc(), use free() instead
|
* If you allocated it with malloc() instead of png_malloc(), use free()
|
||||||
* of png_free().
|
* instead of png_free().
|
||||||
*/
|
*/
|
||||||
png_free(png_ptr, palette);
|
png_free(png_ptr, palette);
|
||||||
palette = NULL;
|
palette = NULL;
|
||||||
|
@ -1047,19 +1020,20 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
*/
|
*/
|
||||||
png_free(png_ptr, trans);
|
png_free(png_ptr, trans);
|
||||||
trans = NULL;
|
trans = NULL;
|
||||||
/* Whenever you use png_free() it is a good idea to set the pointer to
|
|
||||||
|
/* Whenever you use png_free(), it is a good idea to set the pointer to
|
||||||
* NULL in case your application inadvertently tries to png_free() it
|
* NULL in case your application inadvertently tries to png_free() it
|
||||||
* again. When png_free() sees a NULL it returns without action, thus
|
* again. When png_free() sees a NULL it returns without action, avoiding
|
||||||
* avoiding the double-free security problem.
|
* the double-free problem.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Clean up after the write, and free any memory allocated */
|
/* Clean up after the write, and free any allocated memory. */
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
|
|
||||||
/* Close the file */
|
/* Close the file. */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* That's it */
|
/* That's it! */
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|