提交 871b1d0f 编写于 作者: G Glenn Randers-Pehrson

[libpng16] Bump version to 1.6.1beta05

上级 f3af706c
Libpng 1.6.0beta05 - February 3, 2012
Libpng 1.6.1beta05 - March 2, 2013
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
......@@ -9,105 +9,65 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
1.6.0beta05.tar.xz (LZMA-compressed, recommended)
1.6.0beta05.tar.gz
1.6.0beta05.tar.bz2
1.6.1beta05.tar.xz (LZMA-compressed, recommended)
1.6.1beta05.tar.gz
Source files with CRLF line endings (for Windows), without the
"configure" script
lp160b05.7z (LZMA-compressed, recommended)
lp160b05.zip
lp161b05.7z (LZMA-compressed, recommended)
lp161b05.zip
Other information:
1.6.0beta05-README.txt
1.6.0beta05-LICENSE.txt
Changes since the last public release (1.5.7):
Version 1.6.0beta01 [December 15, 2011]
Removed machine-generated configure files from the GIT repository (they will
continue to appear in the tarball distributions).
Restored the new 'simplified' API, which was started in libpng-1.5.7beta02
but later deleted from libpng-1.5.7beta05.
Added example programs for the new 'simplified' API.
Added ANSI-C (C90) headers and require them, and take advantage of the
change. Also fixed some of the projects/* and contrib/* files that needed
updates for libpng16 and the move of pngvalid.c.
With this change the required ANSI-C header files are assumed to exist: the
implementation must provide float.h, limits.h, stdarg.h and stddef.h and
libpng relies on limits.h and stddef.h existing and behaving as defined
(the other two required headers aren't used). Non-ANSI systems that don't
have stddef.h or limits.h will have to provide an appropriate fake
containing the relevant types and #defines.
The use of FAR/far has been eliminated and the definition of png_alloc_size_t
is now controlled by a flag so that 'small size_t' systems can select it
if necessary. Libpng 1.6 may not currently work on such systems -- it
seems likely that it will ask 'malloc' for more than 65535 bytes with any
image that has a sufficiently large row size (rather than simply failing
to read such images).
New tools directory containing tools used to generate libpng code.
Fixed race conditions in parallel make builds. With higher degrees of
parallelism during 'make' the use of the same temporary file names such
as 'dfn*' can result in a race where a temporary file from one arm of the
build is deleted or overwritten in another arm. This changes the
temporary files for suffix rules to always use $* and ensures that the
non-suffix rules use unique file names.
Version 1.6.0beta02 [December 21, 2011]
Correct configure builds where build and source directories are separate.
The include path of 'config.h' was erroneously made relative in pngvalid.c
in libpng 1.5.7.
Version 1.6.0beta03 [December 22, 2011]
Start-up code size improvements, error handler flexibility. These changes
alter how the tricky allocation of the initial png_struct and png_info
structures are handled. png_info is now handled in pretty much the same
way as everything else, except that the allocations handle NULL return
silently. png_struct is changed in a similar way on allocation and on
deallocation a 'safety' error handler is put in place (which should never
be required). The error handler itself is changed to permit mismatches
in the application and libpng error buffer size; however, this means a
silent change to the API to return the jmp_buf if the size doesn't match
the size from the libpng compilation; libpng now allocates the memory and
this may fail. Overall these changes result in slight code size
reductions; however, this is a reduction in code that is always executed
so is particularly valuable. Overall on a 64-bit system the libpng DLL
decreases in code size by 1733 bytes. pngerror.o increases in size by
about 465 bytes because of the new functionality.
Version 1.6.0beta04 [December 30, 2011]
Regenerated configure scripts with automake-1.11.2
Eliminated png_info_destroy(). It is now used only in png.c and only calls
one other internal function and memset().
Enabled png_get_sCAL_fixed() if floating point APIs are enabled. Previously
it was disabled whenever internal fixed point arithmetic was selected,
which meant it didn't exist even on systems where FP was available but not
preferred.
Added pngvalid.c compile time checks for const APIs.
Implemented 'restrict' for png_info and png_struct. Because of the way
libpng works both png_info and png_struct are always accessed via a
single pointer. This means adding C99 'restrict' to the pointer gives
the compiler some opportunity to optimize the code. This change allows
that.
Moved AC_MSG_CHECKING([if libraries can be versioned]) later to the proper
location in configure.ac (Gilles Espinasse).
Changed png_memcpy to C assignment where appropriate. Changed all those
uses of png_memcpy that were doing a simple assignment to assignments
(all those cases where the thing being copied is a non-array C L-value).
Added some error checking to png_set_*() routines.
Removed the reference to the non-exported function png_memcpy() from
example.c.
Fixed the Visual C 64-bit build - it requires jmp_buf to be aligned, but
it had become misaligned.
Revised contrib/pngminus/pnm2png.c to avoid warnings when png_uint_32
and unsigned long are of different sizes.
Version 1.6.0beta05 [February 3, 2012]
Updated manual with description of the simplified API (copied from png.h)
Fix bug in pngerror.c: some long warnings were being improperly truncated
(bug introduced in libpng-1.5.3beta05).
1.6.1beta05-README.txt
1.6.1beta05-LICENSE.txt
Changes since the last public release (1.6.0):
Version 1.6.1beta01 [February 16, 2013]
Made symbol prefixing work with the ARM neon optimizations. Also allow
pngpriv.h to be included for preprocessor definitions only, so it can
be used in non-C/C++ files. Back ported from libpng 1.7.
Made sRGB check numbers consistent.
Ported libpng 1.5 options.awk/dfn file handling to 1.6, fixed one bug.
Removed cc -E workround, corrected png_get_palette_max API Tested on
SUN OS cc 5.9, which demonstrates the tokenization problem previously
avoided by using /lib/cpp. Since all .dfn output is now protected in
double quotes unless it is to be macro substituted the fix should
work everywhere.
Enabled parallel tests - back ported from libpng-1.7.
scripts/pnglibconf.dfa formatting improvements back ported from libpng17.
Fixed a race condition in the creation of the build 'scripts' directory
while building with a parallel make.
Use approved/supported Android method to check for NEON, use Linux/POSIX
1003.1 API to check /proc/self/auxv avoiding buffer allocation and other
library calls (ported from libpng15).
Version 1.6.1beta02 [February 19, 2013]
Use parentheses more consistently in "#if defined(MACRO)" tests.
Folded long lines.
Reenabled code to allow zero length PLTE chunks for MNG.
Version 1.6.1beta03 [February 22, 2013]
Fixed ALIGNED_MEMORY support.
Allow run-time ARM NEON checking to be disabled. A new configure option:
--enable-arm-neon=always will stop the run-time checks. New checks
within arm/arm_init.c will cause the code not to be compiled unless
__ARM_NEON__ is set. This should make it fail safe (if someone asks
for it on then the build will fail if it can't be done.)
Updated the INSTALL document.
Version 1.6.1beta04 [February 27, 2013]
Revised INSTALL to recommend using CPPFLAGS instead of INCLUDES.
Revised scripts/makefile.freebsd to respect ZLIBLIB and ZLIBINC.
Revised scripts/dfn.awk to work with the buggy MSYS awk that has trouble
with CRLF line endings.
Version 1.6.1beta05 [March 2, 2013]
Avoid a possible memory leak in contrib/gregbook/readpng.c
Fixed bug introduced in libpng-1.6.0beta28 that causes libpng to handle chunks
even when they have been tagged PNG_HANDLE_CHUNK_NEVER.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
......
此差异已折叠。
......@@ -35,7 +35,7 @@ enable_testing()
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 6)
set(PNGLIB_RELEASE 0)
set(PNGLIB_RELEASE 1)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
......@@ -191,16 +191,18 @@ if(PNG_TESTS AND PNG_SHARED)
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn1g04.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g01.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g02.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g04.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn2c16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn2c16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbrn2c08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn1g16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn0g16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbyn3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n1g08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n0g08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n2c08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp1n3p08.png
......@@ -209,11 +211,7 @@ endif()
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
IF(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "bin")
ELSE(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
ENDIF(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
# Set a variable with CMake code which:
......@@ -221,7 +219,7 @@ ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
# copies if different.
macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
if(WIN32 AND NOT CYGWIN AND NOT MINGW)
if(WIN32 AND NOT CYGWIN AND NOT MSYS)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}
......@@ -229,10 +227,10 @@ macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
DEPENDS ${PNG_LIB_NAME} ${PNG_LIB_NAME_STATIC}
)
ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
else(WIN32 AND NOT CYGWIN AND NOT MINGW)
else(WIN32 AND NOT CYGWIN AND NOT MSYS)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(WIN32 AND NOT CYGWIN AND NOT MINGW)
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
endmacro()
# libpng is a library so default to 'lib'
......@@ -244,25 +242,25 @@ endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
# 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
# a UNIX look alike
if(NOT WIN32 OR CYGWIN OR MINGW)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
set(LIBS "-lz -lm")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
if(NOT WIN32 OR CYGWIN OR MINGW)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
set(LIBS "-lz -lm")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
endif(NOT WIN32 OR CYGWIN OR MINGW)
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 16.${PNGLIB_RELEASE}.1.6.0beta05
# VERSION 16.${PNGLIB_RELEASE}.1.6.1beta05
VERSION 16.${PNGLIB_RELEASE}.0
SOVERSION 16
CLEAN_DIRECT_OUTPUT 1)
......@@ -334,10 +332,13 @@ if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
endif()
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
if(NOT WIN32 OR CYGWIN OR MINGW)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif(NOT WIN32 OR CYGWIN OR MINGW)
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
# Install man pages
if(NOT PNG_MAN_DIR)
......@@ -346,14 +347,16 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
# Install pkg-config files
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
if(NOT WIN32 OR CYGWIN OR MINGW)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif(NOT WIN32 OR CYGWIN OR MINGW)
endif()
# On versions of CMake that support it, create an export file CMake
......
......@@ -9,16 +9,16 @@ On Unix/Linux and similar systems, you can simply type
and ignore the rest of this document.
If configure does not work on your system and you have a reasonably
up-to-date set of tools, running ./autogen.sh before running ./configure
may fix the problem. You can also run the individual commands in
autogen.sh with the --force option, if supported by your version of
the tools. To be really sure that you aren't using any of the included
pre-built scripts, you can do this:
If configure does not work on your system, or if you have a need to
change configure.ac or Makefile.am, and you have a reasonably
up-to-date set of tools, running ./autogen.sh in a git clone before
running ./configure may fix the problem. To be really sure that you
aren't using any of the included pre-built scripts, you can do this:
./configure --enable-maintainer-mode
make maintainer-clean
./autogen.sh
./autogen.sh --maintainer --clean
./autogen.sh --maintainer
./configure [--prefix=/path] [other options]
make
make install
......@@ -41,19 +41,33 @@ is not already on your system. zlib can usually be found
wherever you got libpng. zlib can be placed in another directory,
at the same level as libpng.
If your system already has a preinstalled zlib you will still need
to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed.
If you wish to test with a particular zlib that is not first in the
standard library search path, put ZLIBLIB, ZLIBINC, CPPFLAGS, LDFLAGS,
and LD_LIBRARY_PATH in your environment before running "make test"
or "make distcheck":
ZLIBLIB=/path/to/lib export ZLIBLIB
ZLIBINC=/path/to/include export ZLIBINC
CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
LDFLAGS="-L$ZLIBLIB" export LDFLAGS
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test".
If you want to use "cmake" (see www.cmake.org), type
cmake . -DCMAKE_INSTALL_PREFIX=/path
make
make install
If your system already has a preinstalled zlib you will still need
to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
or "zlib125") so that you have directories called "zlib" and "libpng".
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.7"
or "zlib127") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
......@@ -71,6 +85,7 @@ Your directory structure should look like this:
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
contrib
gregbook
libtests
pngminim
pngminus
pngsuite
......
......@@ -10,8 +10,8 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.0beta05, February 3, 2012, are
Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
libpng versions 1.2.6, August 15, 2004, through 1.6.1beta05, March 2, 2013, are
Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
......@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
February 3, 2012
March 2, 2013
......@@ -7,19 +7,44 @@ PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
ACLOCAL_AMFLAGS = -I scripts
# test programs - run on make check, make distcheck
TESTS_ENVIRONMENT= srcdir=$(srcdir)
check_PROGRAMS= pngtest
check_PROGRAMS= pngtest pngunknown pngstest pngvalid
pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh
# Only do the following if the contrib directory is present.
check_PROGRAMS+= pngvalid pngstest
pngvalid_SOURCES = contrib/libtests/pngvalid.c
pngstest_SOURCES = contrib/libtests/pngstest.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngstest_SOURCES = contrib/libtests/pngstest.c
pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS += test-pngvalid-simple.sh test-pngvalid-full.sh test-pngstest.sh
pngunknown_SOURCES = contrib/libtests/pngunknown.c
pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
# Generally these are single line shell scripts to run a test with a particular
# set of parameters:
TESTS =\
tests/pngtest\
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
tests/pngvalid-gamma-expand16-background\
tests/pngvalid-gamma-expand16-transform tests/pngvalid-gamma-sbit\
tests/pngvalid-gamma-threshold tests/pngvalid-gamma-transform\
tests/pngvalid-progressive-interlace-size\
tests/pngvalid-progressive-interlace-standard\
tests/pngvalid-progressive-interlace-transform\
tests/pngvalid-progressive-standard tests/pngvalid-standard\
tests/pngstest-0g01 tests/pngstest-0g02 tests/pngstest-0g04\
tests/pngstest-0g08 tests/pngstest-0g16 tests/pngstest-2c08\
tests/pngstest-2c16 tests/pngstest-3p01 tests/pngstest-3p02\
tests/pngstest-3p04 tests/pngstest-3p08 tests/pngstest-4a08\
tests/pngstest-4a16 tests/pngstest-6a08 tests/pngstest-6a16\
tests/pngstest-error tests/pngunknown-IDAT\
tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg
# These tests are expected, and required, to fail:
XFAIL_TESTS = tests/pngstest-error
# man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5
......@@ -35,10 +60,11 @@ lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa
if PNG_ARM_NEON
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/filter_neon.S
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
arm/filter_neon.S
endif
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
......@@ -71,12 +97,14 @@ nodist_pkginclude_HEADERS= pnglibconf.h
pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
#extra source distribution files.
# Extra source distribution files, '${srcdir}' is used below to stop build files
# from those directories being included. This only works if the configure is
# not done in the source directory!
EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
$(TESTS) \
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
CMakeLists.txt example.c libpng-manual.txt
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
......@@ -113,6 +141,7 @@ $(PNGLIB_BASENAME)-config: libpng-config
scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
scripts/prefix.out: png.h pngconf.h pnglibconf.out
scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
scripts/intprefix.out: pnglibconf.h
libpng.sym: scripts/sym.out
rm -f $@
......@@ -158,6 +187,7 @@ $(srcdir)/scripts/pnglibconf.h.prebuilt:
# an installed one (this can happen immediately after on a clean system if
# 'make test' is the first thing the user does.)
contrib/libtests/pngstest.o contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
contrib/libtests/pngunknown.o: pnglibconf.h
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
......@@ -172,23 +202,21 @@ SYMBOL_CFLAGS += -DPNG_PREFIX='@PNG_PREFIX@'
endif
.dfn.out:
rm -f $@ $*.c $*.tf[123]
test -d scripts || mkdir scripts
rm -f $@ $*.c $*.tf[12]
test -d scripts || mkdir scripts || test -d scripts
echo '#include "$<"' >$*.c
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
$(CPPFLAGS) $(SYMBOL_CFLAGS) $*.c > $*.tf1
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
$*.tf1 >$*.tf2
$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' $*.tf2 >$*.tf3
rm -f $*.c $*.tf[12]
mv $*.tf3 $@
$(AWK) -f "${srcdir}/scripts/dfn.awk" out="$*.tf2" $*.tf1 1>&2
rm -f $*.c $*.tf1
mv $*.tf2 $@
# The .dfn file for pnglibconf.h is machine generated
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
rm -f $@ $*.tf[45]
$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
$(DFA_XTRA) 1>&2
${srcdir}/pngusr.dfa $(DFA_XTRA) 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf5 $*.tf4 1>&2
rm $*.tf4
mv $*.tf5 $@
......@@ -230,22 +258,24 @@ dist-hook:
# install the .../include headers as links to the new ones
install-data-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
cd '$(DESTDIR)$(includedir)'; rm -f png.h pngconf.h pnglibconf.h
cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
pngconf.h
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
pnglibconf.h
cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
cd '$(DESTDIR)$(pkgconfigdir)'; rm -f libpng.pc
cd '$(DESTDIR)$(pkgconfigdir)'; $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
# do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
install-exec-hook:
cd $(DESTDIR)$(bindir); rm -f libpng-config
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
cd '$(DESTDIR)$(bindir)'; rm -f libpng-config
cd '$(DESTDIR)$(bindir)';\
$(LN_S) $(PNGLIB_BASENAME)-config libpng-config
@set -x;\
cd $(DESTDIR)$(libdir);\
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
cd '$(DESTDIR)$(libdir)';\
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@\
sl dylib dll.a; do\
rm -f libpng.$$ext;\
if test -f $(PNGLIB_BASENAME).$$ext; then\
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
......@@ -253,9 +283,13 @@ install-exec-hook:
done
uninstall-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
rm -f $(DESTDIR)$(bindir)/libpng-config
rm -f $(DESTDIR)$(libdir)/libpng.a
rm -f $(DESTDIR)$(libdir)/libpng.la
rm -f $(DESTDIR)$(libdir)/libpng.dll.a
cd '$(DESTDIR)$(includedir)'; rm -f png.h pngconf.h pnglibconf.h
rm -f '$(DESTDIR)$(pkgconfigdir)/libpng.pc'
rm -f '$(DESTDIR)$(bindir)/libpng-config'
rm -f '$(DESTDIR)$(libdir)/libpng.a'
rm -f '$(DESTDIR)$(libdir)/libpng.la'
rm -f '$(DESTDIR)$(libdir)/libpng.so'
rm -f '$(DESTDIR)$(libdir)/libpng.so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@'
rm -f '$(DESTDIR)$(libdir)/libpng.sl'
rm -f '$(DESTDIR)$(libdir)/libpng.dylib'
rm -f '$(DESTDIR)$(libdir)/libpng.dll.a'
README for libpng version 1.6.0beta05 - February 3, 2012 (shared library 16.0)
README for libpng version 1.6.1beta05 - March 2, 2013 (shared library 16.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
......@@ -105,7 +105,7 @@ based in a large way on Guy's and Andreas' earlier work), and the PNG
development group.
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
to subscribe) or to glennrp at users.sourceforge.net
......
/* arm_init.c - NEON optimised filter functions
*
* Copyright (c) 2013 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011.
* Last changed in libpng 1.5.15 [%RDATE%]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
* called.
*/
#define _POSIX_SOURCE 1
#include "../pngpriv.h"
#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
defined(__ARM_NEON__)
/* __arm__ is defined by GCC, MSVC defines _M_ARM to the ARM version number,
* Andoid intends to define __ANDROID__, however there are bugs in their
* toolchain; use -D__ANDROID__ to work round this.
*
* __ARM_NEON__ is used to ensure that the compiler has the appropriate ARM
* NEON support
*/
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
#include <signal.h> /* for sig_atomic_t */
#ifdef __ANDROID__
/* Linux provides access to information about CPU capabilites via
* /proc/self/auxv, however Android blocks this while still claiming to be
* Linux. The Andoid NDK, however, provides appropriate support.
*
* Documentation: http://www.kandroid.org/ndk/docs/CPU-ARM-NEON.html
*/
#include <cpu-features.h>
static int
png_have_neon(png_structp png_ptr)
{
/* This is a whole lot easier than the mess below, however it is probably
* implemented as below, therefore it is better to cache the result (these
* function calls may be slow!)
*/
return andoid_getCpuFamily() == ANDROID_CPU_FAMILY_ARM &&
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
}
#elif defined(__linux__)
/* The generic __linux__ implementation requires reading /proc/self/auxv and
* looking at each element for one that records NEON capabilities.
*/
#include <unistd.h> /* for POSIX 1003.1 */
#include <errno.h> /* for EINTR */
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <elf.h>
#include <asm/hwcap.h>
/* A read call may be interrupted, in which case it returns -1 and sets errno to
* EINTR if nothing was done, otherwise (if something was done) a partial read
* may result.
*/
static size_t
safe_read(png_structp png_ptr, int fd, void *buffer_in, size_t nbytes)
{
size_t ntotal = 0;
char *buffer = png_voidcast(char*, buffer_in);
while (nbytes > 0)
{
unsigned int nread;
int iread;
/* Passing nread > INT_MAX to read is implementation defined in POSIX
* 1003.1, therefore despite the unsigned argument portable code must
* limit the value to INT_MAX!
*/
if (nbytes > INT_MAX)
nread = INT_MAX;
else
nread = (unsigned int)/*SAFE*/nbytes;
iread = read(fd, buffer, nread);
if (iread == -1)
{
/* This is the devil in the details, a read can terminate early with 0
* bytes read because of EINTR, yet it still returns -1 otherwise end
* of file cannot be distinguished.
*/
if (errno != EINTR)
{
png_warning(png_ptr, "/proc read failed");
return 0; /* I.e. a permanent failure */
}
}
else if (iread < 0)
{
/* Not a valid 'read' result: */
png_warning(png_ptr, "OS /proc read bug");
return 0;
}
else if (iread > 0)
{
/* Continue reading until a permanent failure, or EOF */
buffer += iread;
nbytes -= (unsigned int)/*SAFE*/iread;
ntotal += (unsigned int)/*SAFE*/iread;
}
else
return ntotal;
}
return ntotal; /* nbytes == 0 */
}
static int
png_have_neon(png_structp png_ptr)
{
int fd = open("/proc/self/auxv", O_RDONLY);
Elf32_auxv_t aux;
/* Failsafe: failure to open means no NEON */
if (fd == -1)
{
png_warning(png_ptr, "/proc/self/auxv open failed");
return 0;
}
while (safe_read(png_ptr, fd, &aux, sizeof aux) == sizeof aux)
{
if (aux.a_type == AT_HWCAP && (aux.a_un.a_val & HWCAP_NEON) != 0)
{
close(fd);
return 1;
}
}
close(fd);
return 0;
}
#else
/* We don't know how to do a run-time check on this system */
# error "no support for run-time ARM NEON checks"
#endif /* OS checks */
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
# error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
#endif
void
png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
{
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED
static volatile sig_atomic_t no_neon = -1; /* not checked */
if (no_neon < 0)
no_neon = !png_have_neon(pp);
if (no_neon)
return;
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
/* IMPORTANT: any new external functions used here must be declared using
* PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the
* 'prefix' option to configure works:
*
* ./configure --with-libpng-prefix=foobar_
*
* Verify you have got this right by running the above command, doing a build
* and examining pngprefix.h; it must contain a #define for every external
* function you add. (Notice that this happens automatically for the
* initialization function.)
*/
pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_neon;
if (bpp == 3)
{
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_neon;
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_neon;
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
png_read_filter_row_paeth3_neon;
}
else if (bpp == 4)
{
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_neon;
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_neon;
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
png_read_filter_row_paeth4_neon;
}
}
#endif /* FILTER_OPTIMIZATIONS && __arm__ && __ARM_NEON__ */
......@@ -3,12 +3,21 @@
*
* Copyright (c) 2011 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011.
* Last changed in libpng 1.5.7 [December 15, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* This is required to get the symbol renames, which are #defines, and also
* includes the value of PNG_FILTER_OPTIMIZATIONS.
*/
#define PNG_VERSION_INFO_ONLY
#include "../pngpriv.h"
#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
defined(__ARM_NEON__)
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
#endif
......@@ -223,3 +232,4 @@ func png_read_filter_row_paeth3_neon, export=1
pop {r4,pc}
endfunc
#endif /* FILTER_OPTIMIZATIONS && __arm__ && __ARM_NEON__ */
......@@ -74,7 +74,7 @@ done
#
# The autotools generated files:
libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in\
config.sub configure depcomp install-sh ltmain.sh missing"
config.sub configure depcomp install-sh ltmain.sh missing test-driver"
#
# These are separate because 'maintainer-clean' does not remove them.
libpng_libtool_files="scripts/libtool.m4 scripts/ltoptions.m4\
......@@ -134,7 +134,7 @@ do
libpng_autotools_file_missing=1
fi
done
#
#
# The cache directory doesn't matter - it will be regenerated and does not exist
# anyway in a tarball.
#
......@@ -213,7 +213,7 @@ case "$mode" in
exec >&2
echo "Your system has a partial set of autotools generated files."
echo "autogen.sh is unable to proceed. The full set of files is"
echo "contained in the distribution archive and you do not need to run"
echo "autogen.sh if you use it."
echo "contained in the libpng 'tar' distribution archive and you do"
echo "not need to run autogen.sh if you use it."
exit 1;;
esac
......@@ -18,17 +18,19 @@ AC_PREREQ([2.68])
dnl Version number stuff here:
AC_INIT([libpng],[1.6.0beta05],[png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng],[1.6.1beta05],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts])
# libpng does not follow GNU file name conventions (hence 'foreign')
# color-tests requires automake 1.11 or later
# silent-rules requires automake 1.11 or later
# dist-xz requires automake 1.11 or later
# 1.11.1 fixes a security issue in 1.11
AM_INIT_AUTOMAKE([1.11.1 foreign dist-xz dist-bzip2 color-tests silent-rules])
# was:
# AM_INIT_AUTOMAKE
# 1.12.2 fixes a security issue in 1.11.2 and 1.12.1
# 1.13 is required for parallel tests
AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules])
# The following line causes --disable-maintainer-mode to be the default to
# configure, this is necessary because libpng distributions cannot rely on the
# time stamps of the autotools generated files being correct
AM_MAINTAINER_MODE
dnl configure.ac and Makefile.am expect automake 1.11.2 or a compatible later
......@@ -37,10 +39,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake
PNGLIB_VERSION=1.6.0beta05
PNGLIB_VERSION=1.6.1beta05
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
PNGLIB_RELEASE=0
PNGLIB_RELEASE=1
dnl End of version number stuff
......@@ -53,8 +55,7 @@ AC_PROG_CC
AM_PROG_AS
LT_PATH_LD
AC_PROG_CPP
AC_CHECK_TOOL(SED, sed, :)
AC_CHECK_TOOL(AWK, awk, :)
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
......@@ -64,30 +65,23 @@ dnl compatible later version may be used
LT_INIT([win32-dll])
LT_PREREQ([2.4.2])
# On Solaris 10 and 12 CPP gets set to cc -E, however this still
# does some input parsing. We need strict ANSI-C style tokenization,
# check this:
AC_REQUIRE_CPP
AC_MSG_CHECKING([for a C preprocessor that does not parse its input])
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[1.1.1 16BIT]])],
[DFNCPP="$CPP"],
[ DFNCPP=""
sav_CPP="$CPP"
for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"
do
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[1.1.1 16BIT]])],
[DFNCPP="$CPP"]
[break],,)
done
CPP="$sav_CPP"
])
if test -n "$DFNCPP"; then
AC_MSG_RESULT([$DFNCPP])
AC_SUBST(DFNCPP)
# Some awks crash when confronted with pnglibconf.dfa, do a test run now
# to make sure this doesn't happen
AC_MSG_CHECKING([that AWK works])
if ${AWK} -f ${srcdir}/scripts/options.awk out="/dev/null" version=search\
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
${srcdir}/pngusr.dfa 1>&2
then
AC_MSG_RESULT([ok])
else
AC_MSG_FAILURE([not found], 1)
AC_MSG_FAILURE([failed], 1)
fi
# This is a remnant of the old cc -E validation, where it may have been
# necessary to use a different preprocessor for .dfn files
DFNCPP="$CPP"
AC_SUBST(DFNCPP)
# -Werror cannot be passed to GCC in CFLAGS because configure will fail (it
# checks the compiler with a program that generates a warning), add the
# following option to deal with this
......@@ -115,7 +109,6 @@ AC_ARG_ENABLE(werror,
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
......@@ -185,9 +178,9 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_ld_version_script" = "yes"; then
AC_MSG_CHECKING([for symbol prefix])
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
| ${CPP-${CC-gcc} -E} - 2>&1 \
| ${EGREP-grep} "^PREFIX=" \
| ${SED-sed} "s:^PREFIX=::"`
| ${CPP-${CC-gcc} -E} - 2>&1 \
| ${EGREP-grep} "^PREFIX=" \
| ${SED-sed} -e "s:^PREFIX=::" -e "s:__USER_LABEL_PREFIX__::"`
AC_SUBST(SYMBOL_PREFIX)
AC_MSG_RESULT($SYMBOL_PREFIX)
fi
......@@ -239,12 +232,20 @@ AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"])
AC_SUBST([AM_CCASFLAGS], [-Wa,--noexecstack])
AC_ARG_ENABLE([arm-neon],
AS_HELP_STRING([[[--enable-arm-neon]]], [Enable ARM NEON optimizations]),
[if test "${enableval}" = "yes"; then
AC_DEFINE([PNG_ARM_NEON], [1], [Enable ARM NEON optimizations])
AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [1], [Align row buffers])
AS_HELP_STRING([[[--enable-arm-neon]]],
[Enable ARM NEON optimizations: use 'always' to turn off run-time checks]),
[if test "${enableval}" = "yes" -o "${enableval}" = "always"; then
AC_DEFINE([PNG_FILTER_OPTIMIZATIONS],
[png_init_filter_functions_neon],
[ARM NEON filter initialization function])
AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [],
[Align row buffers])
if test "${enableval}" = "always"; then
AC_DEFINE([PNG_NO_ARM_NEON_CHECK], [],
[Turn off run-time checking for ARM NEON support])
fi
fi])
AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes])
AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" != "no"])
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
......
......@@ -103,7 +103,7 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
index < num_trans ? trans_alpha[index] : 255);
else /* no transparency */
printf("INDEXED %u = %d %d %d\n", index,
printf("INDEXED %u = %d %d %d\n", index,
palette[index].red, palette[index].green,
palette[index].blue);
}
......@@ -273,7 +273,7 @@ int main(int argc, const char **argv)
ystep = xstep = 1;
}
/* To find the pixel loop over 'py' for each pass
/* To find the pixel, loop over 'py' for each pass
* reading a row and then checking to see if it
* contains the pixel.
*/
......@@ -283,12 +283,13 @@ int main(int argc, const char **argv)
/* png_read_row takes two pointers. When libpng
* handles the interlace the first is filled in
* pixel-by-pixel, the second receives the same
* pixel-by-pixel, and the second receives the same
* pixels but they are replicated across the
* unwritten pixels so far for each pass. When we
* do the interlace, however, they just contain
* the pixels from the interlace pass - giving
* both is wasteful and pointless.
* both is wasteful and pointless, so we pass a
* NULL pointer.
*/
png_read_row(png_ptr, row_tmp, NULL);
......@@ -326,7 +327,7 @@ int main(int argc, const char **argv)
else
{
/* Else libpng has raised an error. An error message has
* already been output, it is only necessary to clean up
* already been output, so it is only necessary to clean up
* locally allocated data:
*/
if (row != NULL)
......
......@@ -29,13 +29,17 @@ int main(int argc, const char **argv)
{
png_image image;
/* Only the image structure version number needs to be set. */
memset(&image, 0, sizeof image);
image.version = PNG_IMAGE_VERSION;
if (png_image_begin_read_from_file(&image, argv[1]))
{
png_bytep buffer;
/* Change this to try different formats! */
/* Change this to try different formats! If you set a colormap format
* then you must also supply a colormap below.
*/
image.format = PNG_FORMAT_RGBA;
buffer = malloc(PNG_IMAGE_SIZE(image));
......@@ -43,10 +47,11 @@ int main(int argc, const char **argv)
if (buffer != NULL)
{
if (png_image_finish_read(&image, NULL/*background*/, buffer,
0/*row_stride*/))
0/*row_stride*/, NULL/*colormap for PNG_FORMAT_FLAG_COLORMAP */))
{
if (png_image_write_to_file(&image, argv[2],
0/*convert_to_8bit*/, buffer, 0/*row_stride*/))
0/*convert_to_8bit*/, buffer, 0/*row_stride*/,
NULL/*colormap*/))
result = 0;
else
......
......@@ -215,6 +215,10 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
* libpng function */
if (setjmp(png_jmpbuf(png_ptr))) {
free(image_data);
image_data = NULL;
free(row_pointers);
row_pointers = NULL;
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
}
......
......@@ -136,29 +136,23 @@ int readpng2_init(mainprog_info *mainprog_ptr)
* used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
{
/* These byte strings were copied from png.h. If a future libpng
* version recognizes more chunks, add them to this list. If a
* future version of readpng2.c recognizes more chunks, delete them
* from this list. */
static /* const */ png_byte chunks_to_ignore[] = {
99, 72, 82, 77, '\0', /* cHRM */
104, 73, 83, 84, '\0', /* hIST */
105, 67, 67, 80, '\0', /* iCCP */
105, 84, 88, 116, '\0', /* iTXt */
111, 70, 70, 115, '\0', /* oFFs */
112, 67, 65, 76, '\0', /* pCAL */
112, 72, 89, 115, '\0', /* pHYs */
115, 66, 73, 84, '\0', /* sBIT */
115, 67, 65, 76, '\0', /* sCAL */
115, 80, 76, 84, '\0', /* sPLT */
115, 84, 69, 82, '\0', /* sTER */
116, 69, 88, 116, '\0', /* tEXt */
116, 73, 77, 69, '\0', /* tIME */
122, 84, 88, 116, '\0' /* zTXt */
};
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
chunks_to_ignore, sizeof(chunks_to_ignore)/5);
/* These byte strings were copied from png.h. If a future version
* of readpng2.c recognizes more chunks, add them to this list.
*/
static PNG_CONST png_byte chunks_to_process[] = {
98, 75, 71, 68, '\0', /* bKGD */
103, 65, 77, 65, '\0', /* gAMA */
115, 82, 71, 66, '\0', /* sRGB */
};
/* Ignore all chunks except for IHDR, PLTE, tRNS, IDAT, and IEND */
png_set_keep_unknown_chunks(png_ptr, -1 /* PNG_HANDLE_CHUNK_NEVER */,
NULL, -1);
/* But do not ignore chunks in the "chunks_to_process" list */
png_set_keep_unknown_chunks(png_ptr,
0 /* PNG_HANDLE_CHUNK_AS_DEFAULT */, chunks_to_process,
sizeof(chunks_to_process)/5);
}
#endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
......
/* Fake a PNG - just write it out directly. */
#include <stdio.h>
#include <zlib.h> /* for crc32 */
void
put_uLong(uLong val)
{
putchar(val >> 24);
putchar(val >> 16);
putchar(val >> 8);
putchar(val >> 0);
}
void
put_chunk(const unsigned char *chunk, uInt length)
{
uLong crc;
put_uLong(length-4); /* Exclude the tag */
fwrite(chunk, length, 1, stdout);
crc = crc32(0, Z_NULL, 0);
put_uLong(crc32(crc, chunk, length));
}
const unsigned char signature[] =
{
137, 80, 78, 71, 13, 10, 26, 10
};
const unsigned char IHDR[] =
{
73, 72, 68, 82, /* IHDR */
0, 0, 0, 1, /* width */
0, 0, 0, 1, /* height */
1, /* bit depth */
0, /* color type: greyscale */
0, /* compression method */
0, /* filter method */
0 /* interlace method: none */
};
const unsigned char unknown[] =
{
'u', 'n', 'K', 'n' /* "unKn" - private safe to copy */
};
int
main(void)
{
fwrite(signature, sizeof signature, 1, stdout);
put_chunk(IHDR, sizeof IHDR);
for(;;)
put_chunk(unknown, sizeof unknown);
}
#!/bin/sh
#
# Copyright (c) 2013 John Cunningham Bowler
#
# Last changed in libpng 1.6.0 [February 14, 2013]
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# Generate a set of PNG test images. The images are generated in a
# sub-directory called 'tests' by default, however a command line argument will
# change that name. The generation requires a built version of makepng in the
# current directory.
#
usage(){
exec >&2
echo "$0 [<directory>]"
echo ' Generate a set of PNG test files in "directory" ("tests" by default)'
exit 1
}
mp="$PWD/makepng"
test -x "$mp" || {
exec >&2
echo "$0: the 'makepng' program must exist"
echo " in the directory within which this program:"
echo " $mp"
echo " is executed"
usage
}
# Just one argument: the directory
testdir="tests"
test $# -gt 1 && {
testdir="$1"
shift
}
test $# -eq 0 || usage
# Take care not to clobber something
if test -e "$testdir"
then
test -d "$testdir" || usage
else
# mkdir -p isn't portable, so do the following
mkdir "$testdir" 2>/dev/null || mkdir -p "$testdir" || usage
fi
# This fails in a very satisfactory way if it's not accessible
cd "$testdir"
:>"test$$.png" || {
exec >&2
echo "$testdir: directory not writable"
usage
}
rm "test$$.png" || {
exec >&2
echo "$testdir: you have create but not write privileges here."
echo " This is unexpected. You have a spurion; "'"'"test$$.png"'"'"."
echo " You need to remove this yourself. Try a different directory."
exit 1
}
# Now call makepng ($mp) to create every file we can think of with a
# reasonable name
doit(){
for gamma in "" --sRGB --linear --1.8
do
case "$gamma" in
"")
gname=;;
--sRGB)
gname="-srgb";;
--linear)
gname="-lin";;
--1.8)
gname="-18";;
*)
gname="-$gamma";;
esac
"$mp" $gamma "$1" "$2" "test-$1-$2$gname.png"
done
}
#
for ct in gray palette
do
for bd in 1 2 4 8
do
doit "$ct" "$bd"
done
done
#
doit "gray" "16"
#
for ct in gray-alpha rgb rgb-alpha
do
for bd in 8 16
do
doit "$ct" "$bd"
done
done
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/* readpng.c
*
* Copyright (c) 2013 John Cunningham Bowler
*
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Load an arbitrary number of PNG files (from the command line, or, if there
* are no arguments on the command line, from stdin) then run a time test by
* reading each file by row. The test does nothing with the read result and
* does no transforms. The only output is a time as a floating point number of
* seconds with 9 decimal digits.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h>
#endif
/* Define the following to use this test against your installed libpng, rather
* than the one being built here:
*/
#ifdef PNG_FREESTANDING_TESTS
# include <png.h>
#else
# include "../../png.h"
#endif
static int
read_png(FILE *fp)
{
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
png_infop info_ptr = NULL;
png_bytep row = NULL, display = NULL;
if (png_ptr == NULL)
return 0;
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
if (row != NULL) free(row);
if (display != NULL) free(display);
return 0;
}
png_init_io(png_ptr, fp);
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL)
png_error(png_ptr, "OOM allocating info structure");
png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_ALWAYS, NULL, 0);
png_read_info(png_ptr, info_ptr);
{
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
row = malloc(rowbytes);
display = malloc(rowbytes);
if (row == NULL || display == NULL)
png_error(png_ptr, "OOM allocating row buffers");
{
png_uint_32 height = png_get_image_height(png_ptr, info_ptr);
int passes = png_set_interlace_handling(png_ptr);
int pass;
png_start_read_image(png_ptr);
for (pass = 0; pass < passes; ++pass)
{
png_uint_32 y = height;
/* NOTE: this trashes the row each time; interlace handling won't
* work, but this avoids memory thrashing for speed testing.
*/
while (y-- > 0)
png_read_row(png_ptr, row, display);
}
}
}
/* Make sure to read to the end of the file: */
png_read_end(png_ptr, info_ptr);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
free(row);
free(display);
return 1;
}
int
main(void)
{
/* Exit code 0 on success. */
return !read_png(stdin);
}
此差异已折叠。
/* timepng.c
*
* Copyright (c) 2012 John Cunningham Bowler
* Copyright (c) 2013 John Cunningham Bowler
*
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Last changed in libpng 1.6.0 [February 14, 2013]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
......@@ -22,7 +22,7 @@
#include <time.h>
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h>
#endif
......
......@@ -14,7 +14,7 @@ LD=$(CC)
RM=rm -f
COPY=cp
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. -O1
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP -I. -O1
C=.c
O=.o
......
# pngminim/decoder/pngusr.dfa
#
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
# Copyright (c) 2010-2013 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
......@@ -37,3 +37,4 @@ option SETJMP on
option STDIO on
option READ_EXPAND on
option READ_STRIP_16_TO_8 on
option USER_LIMITS on
/* minrdpngconf.h: headers to make a minimal png-read-only library
*
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
* Copyright (c) 2007, 2010-2013 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
......
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
The makefile builds a minimal write-only decoder with embedded libpng
The makefile builds a minimal write-only encoder with embedded libpng
and zlib.
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
......
......@@ -14,7 +14,7 @@ LD=$(CC)
RM=rm -f
COPY=cp
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
CFLAGS=-DPNG_USER_CONFIG -DZ_SOLO -DNO_GZIP -I. -O1
C=.c
O=.o
......
# pngminim/encoder/pngusr.dfa
#
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
# Copyright (c) 2010-2013 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
......
/* minwrpngconf.h: headers to make a minimal png-write-only library
*
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
* Copyright (c) 2007, 2010-2013 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
......
......@@ -30,7 +30,7 @@ XLIB = -L/usr/X11R6/lib -lX11
#LIBS = $(XLIB)
LIBS = $(XLIB) -lm #platforms that need libm
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. $(XINC) -O1
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP -I. $(XINC) -O1
C=.c
O=.o
......
# pngminim/preader/pngusr.dfa
#
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
# Copyright (c) 2010-2013 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
......
/* minrdpngconf.h: headers to make a minimal png-read-only library
*
* Copyright (c) 2009, 2010-2011 Glenn Randers-Pehrson
* Copyright (c) 2009, 2010-2013 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
......
......@@ -239,7 +239,7 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
get_token(pnm_file, maxval_token);
sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1)
bit_depth = 1;
else if (maxval <= 3)
......
pngsuite
--------
(c) Willem van Schaik, 1999, 2011
(c) Willem van Schaik, 1999, 2011, 2012
Two images are by Glenn Randers-Pehrson, 2012
Permission to use, copy, modify, and distribute these images for any
purpose and without fee is hereby granted.
......@@ -38,6 +39,8 @@ can use them to test the proper functioning of PNG software.
basn6a08.png 8-bit RGBA
basn6a16.png 16-bit RGBA
ftbbn0g01.png 1-bit grayscale, black bKGD
ftbbn0g02.png 2-bit grayscale, black bKGD
ftbbn0g04.png 4-bit grayscale, black bKGD
ftbbn2c16.png 16-bit truecolor, black bKGD
ftbbn3p08.png 8-bit paletted, black bKGD
......
/* checksum-icc.c
*
* Copyright (c) 2013 John Cunningham Bowler
*
* Last changed in libpng 1.6.0 [February 14, 2013]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Generate crc32 and adler32 checksums of the given input files, used to
* generate check-codes for use when matching ICC profiles within libpng.
*/
#include <stdio.h>
#include <zlib.h>
static int
read_one_file(FILE *ip, const char *name)
{
uLong length = 0;
uLong a32 = adler32(0, NULL, 0);
uLong c32 = crc32(0, NULL, 0);
Byte header[132];
for (;;)
{
int ch = getc(ip);
Byte b;
if (ch == EOF) break;
b = (Byte)ch;
if (length < sizeof header)
header[length] = b;
++length;
a32 = adler32(a32, &b, 1);
c32 = crc32(c32, &b, 1);
}
if (ferror(ip))
return 0;
/* Success */
printf("PNG_ICC_CHECKSUM(0x%8.8lx, 0x%8.8lx,\n PNG_MD5("
"0x%2.2x%2.2x%2.2x%2.2x, 0x%2.2x%2.2x%2.2x%2.2x, 0x%2.2x%2.2x%2.2x%2.2x,"
" 0x%2.2x%2.2x%2.2x%2.2x), %d,\n"
" \"%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d\", %lu, \"%s\")\n",
(unsigned long)a32, (unsigned long)c32,
header[84], header[85], header[86], header[87],
header[88], header[89], header[90], header[91],
header[92], header[93], header[94], header[95],
header[96], header[97], header[98], header[99],
# define u16(x) (header[x] * 256 + header[x+1])
# define u32(x) (u16(x) * 65536 + u16(x+2))
u32(64), u16(24), u16(26), u16(28), u16(30), u16(32), u16(34),
(unsigned long)length, name);
return 1;
}
int main(int argc, char **argv)
{
int err = 0;
printf("/* adler32, crc32, MD5[16], intent, date, length, file-name */\n");
if (argc > 1)
{
int i;
for (i=1; i<argc; ++i)
{
FILE *ip = fopen(argv[i], "rb");
if (ip == NULL || !read_one_file(ip, argv[i]))
{
err = 1;
perror(argv[i]);
fprintf(stderr, "%s: read error\n", argv[i]);
printf("/* ERROR: %s */\n", argv[i]);
}
(void)fclose(ip);
}
}
else
{
if (!read_one_file(stdin, "-"))
{
err = 1;
perror("stdin");
fprintf(stderr, "stdin: read error\n");
printf("/* ERROR: stdin */\n");
}
}
return err;
}
/*-
* convert.c
*
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Last changed in libpng 1.6.0 [February 14, 2013]
*
* COPYRIGHT: Written by John Cunningham Bowler, 2012.
* COPYRIGHT: Written by John Cunningham Bowler, 2013.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.
......
......@@ -2,9 +2,9 @@
#
# intgamma.sh
#
# Last changed in libpng 1.6.0 [(PENDING RELEASE)]
# Last changed in libpng 1.6.0 [February 14, 2013]
#
# COPYRIGHT: Written by John Cunningham Bowler, 2012.
# COPYRIGHT: Written by John Cunningham Bowler, 2013.
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
......
/* makesRGB.c -- build sRGB-to-linear and linear-to-sRGB conversion tables
*
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Last changed in libpng 1.6.0 [February 14, 2013]
*
* COPYRIGHT: Written by John Cunningham Bowler, 2012.
* COPYRIGHT: Written by John Cunningham Bowler, 2013.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.
......
/*-
* sRGB.h
*
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Last changed in libpng 1.6.0 [February 14, 2013]
*
* COPYRIGHT: Written by John Cunningham Bowler, 2012.
* COPYRIGHT: Written by John Cunningham Bowler, 2013.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.
......
......@@ -17,7 +17,7 @@ void PngFileInitialize (HWND hwnd) ;
BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor);
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
int iWidth, int iHeight, png_color BkgColor);
......
......@@ -2,8 +2,8 @@
#if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Maintained 1998-2012 Glenn Randers-Pehrson
* Last changed in libpng 1.6.0 [February 14, 2013]
* Maintained 1998-2013 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* To the extent possible under law, the authors have waived
......@@ -48,7 +48,8 @@ int main(int argc, const char **argv)
png_image image; /* The control structure used by libpng */
/* Initialize the 'png_image' structure. */
memset(&image, 0, sizeof image);
memset(&image, 0, (sizeof image));
image.version = PNG_IMAGE_VERSION;
/* The first argument is the file to read: */
if (png_image_begin_read_from_file(&image, argv[1]))
......@@ -75,16 +76,28 @@ int main(int argc, const char **argv)
* be supplied or the output buffer would have to be initialized to the
* actual background of the image.
*
* The final 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
* 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
* default, minimum, size using PNG_IMAGE_SIZE as above you can pass
* zero.
*
* 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
* you choose what format to make the colormap by setting
* image.format). A colormap is only returned if
* 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
* all images into an index/color-mapped format then you can use:
*
* PNG_IMAGE_COLORMAP_SIZE(image)
*
* to find the maximum size of the colormap in bytes.
*/
if (buffer != NULL &&
png_image_finish_read(&image, NULL/*background*/, buffer,
0/*row_stride*/))
0/*row_stride*/, NULL/*colormap*/))
{
/* Now write the image out to the second argument. In the write
* call 'convert_to_8bit' allows 16-bit data to be squashed down to
......@@ -92,7 +105,7 @@ int main(int argc, const char **argv)
* to the 8-bit format.
*/
if (png_image_write_to_file(&image, argv[2], 0/*convert_to_8bit*/,
buffer, 0/*row_stride*/))
buffer, 0/*row_stride*/, NULL/*colormap*/))
{
/* The image has been written successfully. */
exit(0);
......@@ -833,7 +846,7 @@ void write_png(char *file_name /* , ... other image information ... */)
/* Set the palette if there is one. REQUIRED for indexed-color images */
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
* png_sizeof(png_color));
* (sizeof (png_color)));
/* ... Set palette colors ... */
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
......@@ -864,25 +877,38 @@ void write_png(char *file_name /* , ... other image information ... */)
png_set_gAMA(png_ptr, info_ptr, gamma);
/* Optionally write comments into the image */
text_ptr[0].key = "Title";
text_ptr[0].text = "Mona Lisa";
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[0].itxt_length = 0;
text_ptr[0].lang = NULL;
text_ptr[0].lang_key = NULL;
text_ptr[1].key = "Author";
text_ptr[1].text = "Leonardo DaVinci";
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[1].itxt_length = 0;
text_ptr[1].lang = NULL;
text_ptr[1].lang_key = NULL;
text_ptr[2].key = "Description";
text_ptr[2].text = "<long text>";
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
text_ptr[2].itxt_length = 0;
text_ptr[2].lang = NULL;
text_ptr[2].lang_key = NULL;
png_set_text(png_ptr, info_ptr, text_ptr, 3);
{
png_text text_ptr[3];
char key0[]="Title";
char text0[]="Mona Lisa";
text_ptr[0].key = key0;
text_ptr[0].text = text0;
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[0].itxt_length = 0;
text_ptr[0].lang = NULL;
text_ptr[0].lang_key = NULL;
char key1[]="Author";
char text1[]="Leonardo DaVinci";
text_ptr[1].key = key1;
text_ptr[1].text = text1;
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[1].itxt_length = 0;
text_ptr[1].lang = NULL;
text_ptr[1].lang_key = NULL;
char key2[]="Description";
char text2[]="<long text>";
text_ptr[2].key = key2;
text_ptr[2].text = text2;
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
text_ptr[2].itxt_length = 0;
text_ptr[2].lang = NULL;
text_ptr[2].lang_key = NULL;
png_set_text(write_ptr, write_info_ptr, text_ptr, 3);
}
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
......@@ -955,12 +981,16 @@ void write_png(char *file_name /* , ... other image information ... */)
* use the first method if you aren't handling interlacing yourself.
*/
png_uint_32 k, height, width;
png_byte image[height][width*bytes_per_pixel];
/* In this example, "image" is a one-dimensional array of bytes */
png_byte image[height*width*bytes_per_pixel];
png_bytep row_pointers[height];
if (height > PNG_UINT_32_MAX/png_sizeof(png_bytep))
if (height > PNG_UINT_32_MAX/(sizeof (png_bytep)))
png_error (png_ptr, "Image is too tall to process in memory");
/* Set up pointers into your "image" byte array */
for (k = 0; k < height; k++)
row_pointers[k] = image + k*width*bytes_per_pixel;
......
文件模式从 100755 更改为 100644
此差异已折叠。
此差异已折叠。
.TH LIBPNGPF 3 "February 3, 2012"
.TH LIBPNGPF 3 "March 2, 2013"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.0beta05
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.1beta05
(private functions)
.SH SYNOPSIS
\fB#include \fI"pngpriv.h"
\fI\fB
\fBAs of libpng version \fP\fI1.5.1\fP\fB, this section is no longer \fP\fImaintained\fP\fB, now \fIthat
\fBthe private function prototypes are hidden in pngpriv.h and not \fIaccessible
\fBto applications. Look in pngpriv.h for the prototypes and a short \fIdescription
\fBof each \fIfunction.
\fI\fB
\fBAs of libpng version \fP\fI1.5.1\fP\fB, this section is no longer \fP\fImaintained\fP\fB, now that the private function prototypes are hidden in pngpriv.h and not accessible to applications. Look in pngpriv.h for the prototypes and a short description of each \fIfunction.
.SH DESCRIPTION
The functions previously listed here are used privately by libpng and are not
......
.TH PNG 5 "February 3, 2012"
.TH PNG 5 "March 2, 2013"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/* pnginfo.h - header file for PNG reference library
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng 1.5.0 [January 6, 2011]
* Last changed in libpng 1.6.1 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
......@@ -55,7 +55,7 @@
struct png_info_def
{
/* the following are necessary for every PNG file */
/* The following are necessary for every PNG file */
png_uint_32 width; /* width of image in pixels (from IHDR) */
png_uint_32 height; /* height of image in pixels (from IHDR) */
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
......@@ -70,11 +70,17 @@ struct png_info_def
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
/* The following is informational only on read, and not used on writes. */
/* The following are set by png_set_IHDR, called from the application on
* write, but the are never actually used by the write code.
*/
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
png_byte pixel_depth; /* number of bits per pixel */
png_byte spare_byte; /* to align the data, and for future use */
#ifdef PNG_READ_SUPPORTED
/* This is never set during write */
png_byte signature[8]; /* magic bytes read by libpng from start of file */
#endif
/* The rest of the data is optional. If you are reading, check the
* valid field to see if the information in these are valid. If you
......@@ -82,18 +88,25 @@ struct png_info_def
* and initialize the appropriate fields below.
*/
#if defined(PNG_gAMA_SUPPORTED)
/* The gAMA chunk describes the gamma characteristics of the system
* on which the image was created, normally in the range [1.0, 2.5].
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
/* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
* defined. When COLORSPACE is switched on all the colorspace-defining
* chunks should be enabled, when GAMMA is switched on all the gamma-defining
* chunks should be enabled. If this is not done it becomes possible to read
* inconsistent PNG files and assign a probably incorrect interpretation to
* the information. (In other words, by carefully choosing which chunks to
* recognize the system configuration can select an interpretation for PNG
* files containing ambiguous data and this will result in inconsistent
* behavior between different libpng builds!)
*/
png_fixed_point gamma;
png_colorspace colorspace;
#endif
#ifdef PNG_sRGB_SUPPORTED
/* GR-P, 0.96a */
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
#ifdef PNG_iCCP_SUPPORTED
/* iCCP chunk data. */
png_charp iccp_name; /* profile name */
png_bytep iccp_profile; /* International Color Consortium profile data */
png_uint_32 iccp_proflen; /* ICC profile data length */
#endif
#ifdef PNG_TEXT_SUPPORTED
......@@ -183,23 +196,6 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_uint_16p hist;
#endif
#ifdef PNG_cHRM_SUPPORTED
/* The cHRM chunk describes the CIE color characteristics of the monitor
* on which the PNG was created. This data allows the viewer to do gamut
* mapping of the input image to ensure that the viewer sees the same
* colors in the image as the creator. Values are in the range
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
*/
png_fixed_point x_white;
png_fixed_point y_white;
png_fixed_point x_red;
png_fixed_point y_red;
png_fixed_point x_green;
png_fixed_point y_green;
png_fixed_point x_blue;
png_fixed_point y_blue;
#endif
#ifdef PNG_pCAL_SUPPORTED
/* The pCAL chunk describes a transformation between the stored pixel
* values and original physical data values used to create the image.
......@@ -224,25 +220,20 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
/* New members added in libpng-1.0.6 */
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
/* Storage for unknown chunks that the library doesn't recognize. */
png_unknown_chunkp unknown_chunks;
int unknown_chunks_num;
#endif
#ifdef PNG_iCCP_SUPPORTED
/* iCCP chunk data. */
png_charp iccp_name; /* profile name */
png_bytep iccp_profile; /* International Color Consortium profile data */
png_uint_32 iccp_proflen; /* ICC profile data length */
png_byte iccp_compression; /* Always zero */
/* The type of this field is limited by the type of
* png_struct::user_chunk_cache_max, else overflow can occur.
*/
int unknown_chunks_num;
#endif
#ifdef PNG_sPLT_SUPPORTED
/* Data on sPLT chunks (there may be more than one). */
png_sPLT_tp splt_palettes;
png_uint_32 splt_palettes_num;
int splt_palettes_num; /* Match type returned by png_get API */
#endif
#ifdef PNG_sCAL_SUPPORTED
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* Last changed in libpng 1.6.0 [February 14, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
pngtest.png

8.5 KB | W: | H:

pngtest.png

8.5 KB | W: | H:

pngtest.png
pngtest.png
pngtest.png
pngtest.png
  • 2-up
  • Swipe
  • Onion skin
此差异已折叠。
# pngusr.dfa
#
# Build time configuration of libpng
#
# Enter build configuration options in this file
#
# Security settings: by default these limits are unset, you can change them
# here by entering the appropriate values as #defines preceded by '@' (to cause,
# them to be passed through to the build of pnglibconf.h), for example:
#
# @# define PNG_USER_WIDTH_MAX 1000000
# @# define PNG_USER_HEIGHT_MAX 1000000
# @# define PNG_USER_CHUNK_CACHE_MAX 128
# @# define PNG_USER_CHUNK_MALLOC_MAX 8000000
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
get_uint_32(buf)
get_uint_16(buf)
get_int_32(buf)
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册