[master] Imported from libpng-1.6.31.tar
This commit is contained in:
parent
8c552ddf5b
commit
fbff8986e7
65
ANNOUNCE
65
ANNOUNCE
@ -1,4 +1,4 @@
|
||||
Libpng 1.6.30 - June 28, 2017
|
||||
Libpng 1.6.31 - July 27, 2017
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
|
||||
@ -7,42 +7,51 @@ Files available for download:
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
|
||||
libpng-1.6.30.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.30.tar.gz
|
||||
libpng-1.6.31.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.31.tar.gz
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
|
||||
lpng1630.7z (LZMA-compressed, recommended)
|
||||
lpng1630.zip
|
||||
lpng1631.7z (LZMA-compressed, recommended)
|
||||
lpng1631.zip
|
||||
|
||||
Other information:
|
||||
|
||||
libpng-1.6.30-README.txt
|
||||
libpng-1.6.30-LICENSE.txt
|
||||
libpng-1.6.30-*.asc (armored detached GPG signatures)
|
||||
libpng-1.6.31-README.txt
|
||||
libpng-1.6.31-LICENSE.txt
|
||||
libpng-1.6.31-*.asc (armored detached GPG signatures)
|
||||
|
||||
Changes since the last public release (1.6.29):
|
||||
Changes since the last public release (1.6.30):
|
||||
|
||||
Added missing "$(CPPFLAGS)" to the compile line for c.pic.o in
|
||||
makefile.linux and makefile.solaris-x86 (Cosmin).
|
||||
Revised documentation of png_get_error_ptr() in the libpng manual.
|
||||
Silence clang -Wcomma and const drop warnings (Viktor Szakats).
|
||||
Update Sourceforge URLs in documentation (https instead of http).
|
||||
Document need to check for integer overflow when allocating a pixel
|
||||
buffer for multiple rows in contrib/gregbook, contrib/pngminus,
|
||||
example.c, and in the manual (suggested by Jaeseung Choi). This
|
||||
is similar to the bug reported against pngquant in CVE-2016-5735.
|
||||
Removed reference to the obsolete PNG_SAFE_LIMITS macro in the documentation.
|
||||
Check for integer overflow in contrib/visupng and contrib/tools/genpng.
|
||||
Do not double evaluate CMAKE_SYSTEM_PROCESSOR in CMakeLists.txt.
|
||||
Test CMAKE_HOST_WIN32 instead of WIN32 in CMakeLists.txt.
|
||||
Fix some URL in documentation.
|
||||
Avoid writing an empty IDAT when the last IDAT exactly fills the
|
||||
compression buffer (bug report by Brian Baird). This bug was
|
||||
introduced in libpng-1.6.0.
|
||||
Update copyright year in pnglibconf.h, make ltmain.sh executable.
|
||||
Add a reference to the libpng.download site in README.
|
||||
Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it;
|
||||
bug report by Michael Felt).
|
||||
Revised pngpriv.h to work around failure to compile arm/filter_neon.S
|
||||
("typedef" directive is unrecognized by the assembler). The problem
|
||||
was introduced in libpng-1.6.30beta01.
|
||||
Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx).
|
||||
Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish).
|
||||
Added instructions for disabling hardware optimizations in INSTALL.
|
||||
Added "--enable-hardware-optimizations" configuration flag to enable
|
||||
or disable all hardware optimizations with one flag.
|
||||
Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms.
|
||||
Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent
|
||||
possible integer overflow (Bug report by John Bowler).
|
||||
Quieted "declaration after statement" warnings in intel/filter_sse2.c.
|
||||
Added scripts/makefile-linux-opt, which has hardware optimizations enabled.
|
||||
Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when
|
||||
integers appear on both sides of a compare. Worked around the others by
|
||||
forcing the strict-overflow setting in the relevant functions to a level
|
||||
where they are not reported (John Bowler).
|
||||
Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like
|
||||
the space.
|
||||
Worked around some C-style casts from (void*) because g++ 5.4.0 objects
|
||||
to them.
|
||||
Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint
|
||||
overflow' check that is on by default with -Wall -Wextra.
|
||||
Added eXIf chunk support.
|
||||
Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm
|
||||
tags) to pngtest.png.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
53
CHANGES
53
CHANGES
@ -5855,6 +5855,59 @@ Version 1.6.30rc02 [June 25, 2017]
|
||||
Version 1.6.30 [June 28, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.31beta01 [July 5, 2017]
|
||||
Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it;
|
||||
bug report by Michael Felt).
|
||||
Revised pngpriv.h to work around failure to compile arm/filter_neon.S
|
||||
("typedef" directive is unrecognized by the assembler). The problem
|
||||
was introduced in libpng-1.6.30beta01.
|
||||
Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx).
|
||||
Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish).
|
||||
|
||||
Version 1.6.31beta02 [July 8, 2017]
|
||||
Added instructions for disabling hardware optimizations in INSTALL.
|
||||
Added "--enable-hardware-optimizations" configuration flag to enable
|
||||
or disable all hardware optimizations with one flag.
|
||||
|
||||
Version 1.6.31beta03 [July 9, 2017]
|
||||
Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms.
|
||||
Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent
|
||||
possible integer overflow (Bug report by John Bowler).
|
||||
Quieted "declaration after statement" warnings in intel/filter_sse2.c.
|
||||
Added scripts/makefile-linux-opt, which has hardware optimizations enabled.
|
||||
|
||||
Version 1.6.31beta04 [July 11, 2017]
|
||||
Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when
|
||||
integers appear on both sides of a compare. Worked around the others by
|
||||
forcing the strict-overflow setting in the relevant functions to a level
|
||||
where they are not reported (John Bowler).
|
||||
Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like
|
||||
the space.
|
||||
Worked around some C-style casts from (void*) because g++ 5.4.0 objects
|
||||
to them.
|
||||
Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint
|
||||
overflow' check that is on by default with -Wall -Wextra.
|
||||
|
||||
Version 1.6.31beta05 [July 13, 2017]
|
||||
Added eXIf chunk support.
|
||||
|
||||
Version 1.6.31beta06 [July 17, 2017]
|
||||
Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm
|
||||
tags) to pngtest.png.
|
||||
|
||||
Version 1.6.31beta07 [July 18, 2017]
|
||||
Revised the eXIf chunk in pngtest.png to fix "Bad IFD1 Directory" warning.
|
||||
|
||||
Version 1.6.31rc01 [July 19, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.31rc02 [July 25, 2017]
|
||||
Fixed typo in example.c (png_free_image should be png_image_free) (Bug
|
||||
report by John Smith)
|
||||
|
||||
Version 1.6.31 [July 27, 2017]
|
||||
No changes.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
|
@ -1,6 +1,6 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
# Copyright (C) 2007,2009-2016 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2007,2009-2017 Glenn Randers-Pehrson
|
||||
# Written by Christian Ehrlicher, 2007
|
||||
# Revised by Roger Lowman, 2009-2010
|
||||
# Revised by Clifford Yapp, 2011-2012
|
||||
@ -36,7 +36,7 @@ enable_testing()
|
||||
|
||||
set(PNGLIB_MAJOR 1)
|
||||
set(PNGLIB_MINOR 6)
|
||||
set(PNGLIB_RELEASE 30)
|
||||
set(PNGLIB_RELEASE 31)
|
||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||
|
||||
@ -76,9 +76,13 @@ option(PNG_FRAMEWORK "Build OS X framework" OFF)
|
||||
option(PNG_DEBUG "Build with debug output" OFF)
|
||||
option(PNGARG "Disable ANSI-C prototypes" OFF)
|
||||
|
||||
option(PNG_HARDWARE_OPTIMIZATIONS "Enable Hardware Optimizations" ON)
|
||||
|
||||
|
||||
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
|
||||
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
|
||||
|
||||
if(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
# set definitions and sources for arm
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
||||
@ -112,11 +116,9 @@ endif()
|
||||
# set definitions and sources for powerpc
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*" )
|
||||
set(PNG_POWERPC_VSX_POSSIBLE_VALUES check on off)
|
||||
set(PNG_POWERPC_VSX "check" CACHE STRING "Enable POWERPC VSX optimizations:
|
||||
check: (default) use internal checking code;
|
||||
off: disable the optimizations;
|
||||
on: turn on unconditionally.")
|
||||
set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off)
|
||||
set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations:
|
||||
off: disable the optimizations.")
|
||||
set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS
|
||||
${PNG_POWERPC_VSX_POSSIBLE_VALUES})
|
||||
list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index)
|
||||
@ -127,19 +129,62 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
||||
set(libpng_powerpc_sources
|
||||
powerpc/powerpc_init.c
|
||||
powerpc/filter_vsx_intrinsics.c)
|
||||
|
||||
if(${PNG_POWERPC_VSX} STREQUAL "on")
|
||||
add_definitions(-DPNG_POWERPC_VSX_OPT=2)
|
||||
elseif(${PNG_POWERPC_VSX} STREQUAL "check")
|
||||
add_definitions(-DPNG_POWERPC_VSX_CHECK_SUPPORTED)
|
||||
message(WARNING
|
||||
"[PNG_POWERPC_VSX==check] Please check contrib/powerpc/README file for the list of supported OSes.")
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# set definitions and sources for intel
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*" )
|
||||
set(PNG_INTEL_SSE_POSSIBLE_VALUES on off)
|
||||
set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations:
|
||||
off: disable the optimizations")
|
||||
set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS
|
||||
${PNG_INTEL_SSE_POSSIBLE_VALUES})
|
||||
list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index)
|
||||
if(index EQUAL -1)
|
||||
message(FATAL_ERROR
|
||||
" PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]")
|
||||
elseif(NOT ${PNG_INTEL_SSE} STREQUAL "no")
|
||||
set(libpng_intel_sources
|
||||
intel/intel_init.c
|
||||
intel/filter_sse2_intrinsics.c)
|
||||
if(${PNG_INTEL_SSE} STREQUAL "on")
|
||||
add_definitions(-DPNG_INTEL_SSE_OPT=1)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DPNG_INTEL_SSE_OPT=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# set definitions and sources for MIPS
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*" )
|
||||
set(PNG_MIPS_MSA_POSSIBLE_VALUES on off)
|
||||
set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations:
|
||||
off: disable the optimizations")
|
||||
set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS
|
||||
${PNG_MIPS_MSA_POSSIBLE_VALUES})
|
||||
list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index)
|
||||
if(index EQUAL -1)
|
||||
message(FATAL_ERROR
|
||||
" PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]")
|
||||
elseif(NOT ${PNG_MIPS_MSA} STREQUAL "no")
|
||||
set(libpng_mips_sources
|
||||
mips/mips_init.c
|
||||
mips/filter_msa_intrinsics.c)
|
||||
if(${PNG_MIPS_MSA} STREQUAL "on")
|
||||
add_definitions(-DPNG_MIPS_MSA_OPT=2)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
||||
endif()
|
||||
endif()
|
||||
endif(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
|
||||
# SET LIBNAME
|
||||
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
@ -432,6 +477,8 @@ set(libpng_sources
|
||||
pngwtran.c
|
||||
pngwutil.c
|
||||
${libpng_arm_sources}
|
||||
${libpng_intel_sources}
|
||||
${libpng_mips_sources}
|
||||
${libpng_powerpc_sources}
|
||||
)
|
||||
set(pngtest_sources
|
||||
@ -726,12 +773,12 @@ macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
|
||||
DEPENDS ${PNG_LIB_TARGETS}
|
||||
)
|
||||
ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
||||
else(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
get_filename_component(LINK_TARGET "${SRC_FILE}" NAME)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
endmacro()
|
||||
|
||||
# Create source generation scripts.
|
||||
@ -770,7 +817,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
# SET UP LINKS
|
||||
if(PNG_SHARED)
|
||||
set_target_properties(png PROPERTIES
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.30
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.31
|
||||
VERSION 16.${PNGLIB_RELEASE}.0
|
||||
SOVERSION 16
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
@ -855,7 +902,7 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||
DESTINATION bin)
|
||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
endif(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW)
|
||||
endif()
|
||||
|
||||
# On versions of CMake that support it, create an export file CMake
|
||||
|
67
INSTALL
67
INSTALL
@ -16,10 +16,11 @@ Contents
|
||||
XI. Prepending a prefix to exported symbols
|
||||
XII. Configuring for compiler xxx:
|
||||
XIII. Removing unwanted object code
|
||||
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
XV. Setjmp/longjmp issues
|
||||
XVI. Common linking failures
|
||||
XVII. Other sources of information about libpng
|
||||
XIV. Enabling or disabling hardware optimizations
|
||||
XV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
XVI. Setjmp/longjmp issues
|
||||
XVII. Common linking failures
|
||||
XVIII. Other sources of information about libpng
|
||||
|
||||
I. Simple installation
|
||||
|
||||
@ -281,7 +282,57 @@ library to fail if they call functions not available in your library.
|
||||
The size of the library itself should not be an issue, because only
|
||||
those sections that are actually used will be loaded into memory.
|
||||
|
||||
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
XIV. Enabling or disabling hardware optimizations
|
||||
|
||||
Certain hardware capabilites, such as the Intel SSE instructions,
|
||||
are normally detected at run time. Enable them with configure options
|
||||
such as one of
|
||||
|
||||
--enable-arm-neon=yes
|
||||
--enable-mips-msa=yes
|
||||
--enable-intel-sse=yes
|
||||
--enable-powerpc-vsx=yes
|
||||
|
||||
or enable them all at once with
|
||||
|
||||
--enable-hardware-optimizations=yes
|
||||
|
||||
or, if you are not using "configure", you can use one
|
||||
or more of
|
||||
|
||||
CPPFLAGS += "-DPNG_ARM_NEON"
|
||||
CPPFLAGS += "-DPNG_MIPS_MSA"
|
||||
CPPFLAGS += "-DPNG_INTEL_SSE"
|
||||
CPPFLAGS += "-DPNG_POWERPC_VSX"
|
||||
|
||||
See for example scripts/makefile.linux-opt
|
||||
|
||||
If you wish to avoid using them,
|
||||
you can disable them via the configure option
|
||||
|
||||
--disable-hardware-optimizations
|
||||
|
||||
to disable them all, or
|
||||
|
||||
--enable-intel-sse=no
|
||||
|
||||
to disable a particular one,
|
||||
or via compiler-command options such as
|
||||
|
||||
CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0,
|
||||
-DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0"
|
||||
|
||||
If you are using cmake, hardware optimizations are "on"
|
||||
by default. To disable them, use
|
||||
|
||||
cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \
|
||||
-DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no
|
||||
|
||||
or disable them all at once with
|
||||
|
||||
cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
|
||||
|
||||
XV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
|
||||
Details of internal changes to the library code can be found in the CHANGES
|
||||
file and in the GIT repository logs. These will be of no concern to the vast
|
||||
@ -372,7 +423,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built
|
||||
libpng, because than the settings would not accurately reflect the settings
|
||||
that were used to build libpng.
|
||||
|
||||
XV. Setjmp/longjmp issues
|
||||
XVI. Setjmp/longjmp issues
|
||||
|
||||
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
|
||||
is known to be not thread-safe on some platforms and we don't know of
|
||||
@ -390,7 +441,7 @@ This requires setjmp/longjmp, so you must either build the library
|
||||
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
|
||||
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
|
||||
|
||||
XVI. Common linking failures
|
||||
XVII. Common linking failures
|
||||
|
||||
If your application fails to find libpng or zlib entries while linking:
|
||||
|
||||
@ -402,7 +453,7 @@ If your application fails to find libpng or zlib entries while linking:
|
||||
If you are using the vstudio project, observe the WARNING in
|
||||
project/vstudio/README.txt.
|
||||
|
||||
XVII. Other sources of information about libpng:
|
||||
XVIII. Other sources of information about libpng:
|
||||
|
||||
Further information can be found in the README and libpng-manual.txt
|
||||
files, in the individual makefiles, in png.h, and the manual pages
|
||||
|
2
LICENSE
2
LICENSE
@ -10,7 +10,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.30, June 28, 2017 are
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
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
|
||||
|
2
README
2
README
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.6.30 - June 28, 2017 (shared library 16.0)
|
||||
README for libpng version 1.6.31 - July 27, 2017 (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.
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* filter_neon.S - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -16,7 +16,7 @@
|
||||
#define PNG_VERSION_INFO_ONLY
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||
#endif
|
||||
|
||||
|
55
configure.ac
55
configure.ac
@ -25,7 +25,7 @@ AC_PREREQ([2.68])
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng],[1.6.30],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_INIT([libpng],[1.6.31],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts])
|
||||
|
||||
# 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 stop configure from automagically running automake
|
||||
|
||||
PNGLIB_VERSION=1.6.30
|
||||
PNGLIB_VERSION=1.6.31
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=6
|
||||
PNGLIB_RELEASE=30
|
||||
PNGLIB_RELEASE=31
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
@ -300,6 +300,55 @@ AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
|
||||
# HOST SPECIFIC OPTIONS
|
||||
# =====================
|
||||
#
|
||||
# DEFAULT
|
||||
# =======
|
||||
#
|
||||
AC_ARG_ENABLE([hardware-optimizations],
|
||||
AS_HELP_STRING([[[--enable-hardware-optimizations]]],
|
||||
[Enable hardware optimizations: =no/off, yes/on:]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
# disable hardware optimization on all systems:
|
||||
enable_arm_neon=no
|
||||
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
||||
[Disable ARM_NEON optimizations])
|
||||
enable_mips_msa=no
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||
[Disable MIPS_MSA optimizations])
|
||||
enable_powerpc_vsx=no
|
||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
|
||||
[Disable POWERPC VSX optimizations])
|
||||
enable_intel_sse=no
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
||||
[Disable INTEL_SSE optimizations])
|
||||
;;
|
||||
*)
|
||||
# allow enabling hardware optimization on any system:
|
||||
case "$host_cpu" in
|
||||
arm*|aarch64*)
|
||||
enable_arm_neon=yes
|
||||
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
||||
[Enable ARM_NEON optimizations])
|
||||
;;
|
||||
mipsel*|mips64el*)
|
||||
enable_mips_msa=yes
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||
[Enable MIPS_MSA optimizations])
|
||||
;;
|
||||
i?86|x86_64)
|
||||
enable_intel_sse=yes
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
||||
[Enable Intel SSE optimizations])
|
||||
;;
|
||||
powerpc*|ppc64*)
|
||||
enable_powerpc_vsx=yes
|
||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
|
||||
[Enable POWERPC VSX optimizations])
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac])
|
||||
|
||||
# ARM
|
||||
# ===
|
||||
#
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* contrib/arm-neon/linux.c
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by John Bowler, 2014.
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2014, 2017 Glenn Randers-Pehrson
|
||||
* Written by John Bowler, 2014, 2017.
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -62,7 +62,7 @@ png_have_neon(png_structp png_ptr)
|
||||
|
||||
counter=0;
|
||||
state = Feature;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case Feature:
|
||||
/* Match 'FEATURE', ASCII case insensitive. */
|
||||
@ -75,7 +75,7 @@ png_have_neon(png_structp png_ptr)
|
||||
|
||||
/* did not match 'feature' */
|
||||
state = SkipLine;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case SkipLine:
|
||||
skipLine:
|
||||
@ -110,7 +110,7 @@ png_have_neon(png_structp png_ptr)
|
||||
|
||||
state = Neon;
|
||||
counter = 0;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case Neon:
|
||||
/* Look for 'neon' tag */
|
||||
@ -122,7 +122,7 @@ png_have_neon(png_structp png_ptr)
|
||||
}
|
||||
|
||||
state = SkipTag;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case SkipTag:
|
||||
/* Skip non-space characters */
|
||||
|
@ -1,9 +1,8 @@
|
||||
/*-
|
||||
* pngstest.c
|
||||
*
|
||||
* Copyright (c) 2013-2016 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2013-2017 John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -2746,22 +2745,27 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
*/
|
||||
else if ((a->opts & ACCUMULATE) == 0)
|
||||
{
|
||||
# ifdef __GNUC__
|
||||
# define BYTE_CHARS 20 /* 2^32: GCC sprintf warning */
|
||||
# else
|
||||
# define BYTE_CHARS 3 /* 2^8: real maximum value */
|
||||
# endif
|
||||
/* Check the original image first,
|
||||
* TODO: deal with input images with bad pixel values?
|
||||
*/
|
||||
if (amax >= a->image.colormap_entries)
|
||||
{
|
||||
char pindex[9];
|
||||
sprintf(pindex, "%d[%lu]", amax,
|
||||
(unsigned long)a->image.colormap_entries);
|
||||
char pindex[3+2*BYTE_CHARS];
|
||||
sprintf(pindex, "%d[%u]", amax,
|
||||
(png_byte)/*SAFE*/a->image.colormap_entries);
|
||||
return logerror(a, a->file_name, ": bad pixel index: ", pindex);
|
||||
}
|
||||
|
||||
else if (bmax >= b->image.colormap_entries)
|
||||
{
|
||||
char pindex[9];
|
||||
sprintf(pindex, "%d[%lu]", bmax,
|
||||
(unsigned long)b->image.colormap_entries);
|
||||
char pindex[3+2*BYTE_CHARS];
|
||||
sprintf(pindex, "%d[%u]", bmax,
|
||||
(png_byte)/*SAFE*/b->image.colormap_entries);
|
||||
return logerror(b, b->file_name, ": bad pixel index: ", pindex);
|
||||
}
|
||||
}
|
||||
@ -2881,10 +2885,13 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
{
|
||||
case 4:
|
||||
if (pua[btoa[3]] != pub[3]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 3:
|
||||
if (pua[btoa[2]] != pub[2]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
if (pua[btoa[1]] != pub[1]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
if (pua[btoa[0]] != pub[0]) break;
|
||||
if (alpha_added != 4 && pub[alpha_added] != 65535) break;
|
||||
@ -2900,10 +2907,13 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
{
|
||||
case 4:
|
||||
if (psa[btoa[3]] != psb[3]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 3:
|
||||
if (psa[btoa[2]] != psb[2]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
if (psa[btoa[1]] != psb[1]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
if (psa[btoa[0]] != psb[0]) break;
|
||||
if (alpha_added != 4 && psb[alpha_added] != 255) break;
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngunknown.c - test the read side unknown chunk handling
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 2015,2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2015,2017 Glenn Randers-Pehrson
|
||||
* Written by John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
@ -614,7 +614,7 @@ get_unknown(display *d, png_infop info_ptr, int after_IDAT)
|
||||
++(d->error_count);
|
||||
break;
|
||||
}
|
||||
/* FALL THROUGH (safe) */
|
||||
/* FALLTHROUGH */ /* (safe) */
|
||||
case PNG_HANDLE_CHUNK_ALWAYS:
|
||||
break;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngvalid.c - validate libpng by constructing then reading png files.
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2014-2017 John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
@ -6584,16 +6584,16 @@ transform_info_imp(transform_display *dp, png_structp pp, png_infop pi)
|
||||
{
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
if (dp->output_bit_depth > 8) goto error;
|
||||
/*FALL THROUGH*/
|
||||
/* FALLTHROUGH */
|
||||
case PNG_COLOR_TYPE_GRAY:
|
||||
if (dp->output_bit_depth == 1 || dp->output_bit_depth == 2 ||
|
||||
dp->output_bit_depth == 4)
|
||||
break;
|
||||
/*FALL THROUGH*/
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
if (dp->output_bit_depth == 8 || dp->output_bit_depth == 16)
|
||||
break;
|
||||
/*FALL THROUGH*/
|
||||
/* FALLTHROUGH */
|
||||
error:
|
||||
{
|
||||
char message[128];
|
||||
@ -9994,9 +9994,9 @@ gamma_component_validate(const char *name, const validate_info *vi,
|
||||
case PNG_BACKGROUND_GAMMA_FILE:
|
||||
case PNG_BACKGROUND_GAMMA_UNIQUE:
|
||||
use_background = (alpha >= 0 && alpha < 1);
|
||||
/*FALL THROUGH*/
|
||||
# endif
|
||||
# ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
/* FALLTHROUGH */
|
||||
case ALPHA_MODE_OFFSET + PNG_ALPHA_STANDARD:
|
||||
case ALPHA_MODE_OFFSET + PNG_ALPHA_BROKEN:
|
||||
case ALPHA_MODE_OFFSET + PNG_ALPHA_OPTIMIZED:
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
# Copyright (c) 2015 John Cunningham Bowler
|
||||
|
||||
# Last changed in libpng 1.7.0 [(PENDING RELEASE)]
|
||||
# Last changed in libpng 1.6.20 [December 3, 2015]
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
|
@ -1,8 +1,7 @@
|
||||
/* pngfix.c
|
||||
*
|
||||
* Copyright (c) 2014-2016 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2014-2017 John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -2416,7 +2415,7 @@ zlib_advance(struct zlib *zlib, png_uint_32 nbytes)
|
||||
endrc = ZLIB_TOO_FAR_BACK;
|
||||
break;
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
default:
|
||||
zlib_message(zlib, 0/*stream error*/);
|
||||
@ -2570,7 +2569,7 @@ zlib_run(struct zlib *zlib)
|
||||
list->lengths[i] -= zlib->extra_bytes;
|
||||
list->count = i+1;
|
||||
zlib->idat->idat_list_tail = list;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
default:
|
||||
return rc;
|
||||
@ -2673,7 +2672,7 @@ zlib_check(struct file *file, png_uint_32 offset)
|
||||
/* Truncated stream; unrecoverable, gets converted to ZLIB_FATAL */
|
||||
zlib.z.msg = PNGZ_MSG_CAST("[truncated]");
|
||||
zlib_message(&zlib, 0/*expected*/);
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
default:
|
||||
/* Unrecoverable error; skip the chunk; a zlib_message has already
|
||||
@ -3341,7 +3340,7 @@ read_callback(png_structp png_ptr, png_bytep buffer, size_t count)
|
||||
if (file->state != STATE_IDAT && length > 0)
|
||||
setpos(chunk);
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
default:
|
||||
assert(chunk != NULL);
|
||||
|
@ -114,13 +114,13 @@ int main(int argc, const char **argv)
|
||||
|
||||
else
|
||||
{
|
||||
/* Calling png_free_image 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
|
||||
* memory for 'buffer' we didn't complete the read, so we must free
|
||||
* the image:
|
||||
*/
|
||||
if (buffer == NULL)
|
||||
png_free_image(&image);
|
||||
png_image_free(&image);
|
||||
|
||||
else
|
||||
free(buffer);
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Written by Mike Klein and Matt Sarett
|
||||
* Derived from arm/filter_neon_intrinsics.c
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -40,7 +40,7 @@ static __m128i load3(const void* p) {
|
||||
/* We'll load 2 bytes, then 1 byte,
|
||||
* then mask them together, and finally load into SSE.
|
||||
*/
|
||||
const png_uint_16* p01 = p;
|
||||
const png_uint_16* p01 = (png_const_uint_16p)p;
|
||||
const png_byte* p2 = (const png_byte*)(p01+1);
|
||||
|
||||
png_uint_32 v012 = (png_uint_32)(*p01)
|
||||
@ -53,12 +53,15 @@ static void store3(void* p, __m128i v) {
|
||||
* its bottom two bytes, then its third byte.
|
||||
*/
|
||||
png_uint_32 v012;
|
||||
png_uint_16* p01;
|
||||
png_byte* p2;
|
||||
|
||||
store4(&v012, v);
|
||||
|
||||
png_uint_16* p01 = p;
|
||||
png_byte* p2 = (png_byte*)(p01+1);
|
||||
*p01 = v012;
|
||||
*p2 = v012 >> 16;
|
||||
p01 = (png_uint_16p)p;
|
||||
p2 = (png_byte*)(p01+1);
|
||||
*p01 = (png_uint_16)v012;
|
||||
*p2 = (png_byte)(v012 >> 16);
|
||||
}
|
||||
|
||||
void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
|
||||
@ -68,10 +71,13 @@ void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
|
||||
* There is no pixel to the left of the first pixel. It's encoded directly.
|
||||
* That works with our main loop if we just say that left pixel was zero.
|
||||
*/
|
||||
png_debug(1, "in png_read_filter_row_sub3_sse2");
|
||||
png_size_t rb;
|
||||
|
||||
__m128i a, d = _mm_setzero_si128();
|
||||
|
||||
int rb = row_info->rowbytes;
|
||||
png_debug(1, "in png_read_filter_row_sub3_sse2");
|
||||
|
||||
rb = row_info->rowbytes;
|
||||
while (rb >= 4) {
|
||||
a = d; d = load4(row);
|
||||
d = _mm_add_epi8(d, a);
|
||||
@ -88,6 +94,7 @@ void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
|
||||
row += 3;
|
||||
rb -= 3;
|
||||
}
|
||||
PNG_UNUSED(prev)
|
||||
}
|
||||
|
||||
void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
|
||||
@ -97,11 +104,14 @@ void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
|
||||
* There is no pixel to the left of the first pixel. It's encoded directly.
|
||||
* That works with our main loop if we just say that left pixel was zero.
|
||||
*/
|
||||
png_debug(1, "in png_read_filter_row_sub4_sse2");
|
||||
png_size_t rb;
|
||||
|
||||
__m128i a, d = _mm_setzero_si128();
|
||||
|
||||
int rb = row_info->rowbytes;
|
||||
while (rb > 0) {
|
||||
png_debug(1, "in png_read_filter_row_sub4_sse2");
|
||||
|
||||
rb = row_info->rowbytes+4;
|
||||
while (rb > 4) {
|
||||
a = d; d = load4(row);
|
||||
d = _mm_add_epi8(d, a);
|
||||
store4(row, d);
|
||||
@ -109,6 +119,7 @@ void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
|
||||
row += 4;
|
||||
rb -= 4;
|
||||
}
|
||||
PNG_UNUSED(prev)
|
||||
}
|
||||
|
||||
void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row,
|
||||
@ -119,18 +130,23 @@ void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row,
|
||||
* predicted to be half of the pixel above it. So again, this works
|
||||
* perfectly with our loop if we make sure a starts at zero.
|
||||
*/
|
||||
png_debug(1, "in png_read_filter_row_avg3_sse2");
|
||||
|
||||
png_size_t rb;
|
||||
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
|
||||
__m128i b;
|
||||
__m128i a, d = zero;
|
||||
|
||||
int rb = row_info->rowbytes;
|
||||
png_debug(1, "in png_read_filter_row_avg3_sse2");
|
||||
rb = row_info->rowbytes;
|
||||
while (rb >= 4) {
|
||||
__m128i avg;
|
||||
b = load4(prev);
|
||||
a = d; d = load4(row );
|
||||
|
||||
/* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
|
||||
__m128i avg = _mm_avg_epu8(a,b);
|
||||
avg = _mm_avg_epu8(a,b);
|
||||
/* ...but we can fix it up by subtracting off 1 if it rounded up. */
|
||||
avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a,b),
|
||||
_mm_set1_epi8(1)));
|
||||
@ -142,11 +158,12 @@ void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row,
|
||||
rb -= 3;
|
||||
}
|
||||
if (rb > 0) {
|
||||
__m128i avg;
|
||||
b = load3(prev);
|
||||
a = d; d = load3(row );
|
||||
|
||||
/* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
|
||||
__m128i avg = _mm_avg_epu8(a,b);
|
||||
avg = _mm_avg_epu8(a,b);
|
||||
/* ...but we can fix it up by subtracting off 1 if it rounded up. */
|
||||
avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a,b),
|
||||
_mm_set1_epi8(1)));
|
||||
@ -168,18 +185,21 @@ void png_read_filter_row_avg4_sse2(png_row_infop row_info, png_bytep row,
|
||||
* predicted to be half of the pixel above it. So again, this works
|
||||
* perfectly with our loop if we make sure a starts at zero.
|
||||
*/
|
||||
png_debug(1, "in png_read_filter_row_avg4_sse2");
|
||||
png_size_t rb;
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i b;
|
||||
__m128i a, d = zero;
|
||||
|
||||
int rb = row_info->rowbytes;
|
||||
while (rb > 0) {
|
||||
png_debug(1, "in png_read_filter_row_avg4_sse2");
|
||||
|
||||
rb = row_info->rowbytes+4;
|
||||
while (rb > 4) {
|
||||
__m128i avg;
|
||||
b = load4(prev);
|
||||
a = d; d = load4(row );
|
||||
|
||||
/* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
|
||||
__m128i avg = _mm_avg_epu8(a,b);
|
||||
avg = _mm_avg_epu8(a,b);
|
||||
/* ...but we can fix it up by subtracting off 1 if it rounded up. */
|
||||
avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a,b),
|
||||
_mm_set1_epi8(1)));
|
||||
@ -237,38 +257,42 @@ void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row,
|
||||
* Here we zero b and d, which become c and a respectively at the start of
|
||||
* the loop.
|
||||
*/
|
||||
png_debug(1, "in png_read_filter_row_paeth3_sse2");
|
||||
png_size_t rb;
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i c, b = zero,
|
||||
a, d = zero;
|
||||
|
||||
int rb = row_info->rowbytes;
|
||||
png_debug(1, "in png_read_filter_row_paeth3_sse2");
|
||||
|
||||
rb = row_info->rowbytes;
|
||||
while (rb >= 4) {
|
||||
/* It's easiest to do this math (particularly, deal with pc) with 16-bit
|
||||
* intermediates.
|
||||
*/
|
||||
__m128i pa,pb,pc,smallest,nearest;
|
||||
c = b; b = _mm_unpacklo_epi8(load4(prev), zero);
|
||||
a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
|
||||
|
||||
/* (p-a) == (a+b-c - a) == (b-c) */
|
||||
__m128i pa = _mm_sub_epi16(b,c);
|
||||
|
||||
pa = _mm_sub_epi16(b,c);
|
||||
|
||||
/* (p-b) == (a+b-c - b) == (a-c) */
|
||||
__m128i pb = _mm_sub_epi16(a,c);
|
||||
pb = _mm_sub_epi16(a,c);
|
||||
|
||||
/* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
|
||||
__m128i pc = _mm_add_epi16(pa,pb);
|
||||
pc = _mm_add_epi16(pa,pb);
|
||||
|
||||
pa = abs_i16(pa); /* |p-a| */
|
||||
pb = abs_i16(pb); /* |p-b| */
|
||||
pc = abs_i16(pc); /* |p-c| */
|
||||
|
||||
__m128i smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
|
||||
smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
|
||||
|
||||
/* Paeth breaks ties favoring a over b over c. */
|
||||
__m128i nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
|
||||
if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
|
||||
c));
|
||||
nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
|
||||
if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
|
||||
c));
|
||||
|
||||
/* Note `_epi8`: we need addition to wrap modulo 255. */
|
||||
d = _mm_add_epi8(d, nearest);
|
||||
@ -282,26 +306,27 @@ void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row,
|
||||
/* It's easiest to do this math (particularly, deal with pc) with 16-bit
|
||||
* intermediates.
|
||||
*/
|
||||
__m128i pa,pb,pc,smallest,nearest;
|
||||
c = b; b = _mm_unpacklo_epi8(load3(prev), zero);
|
||||
a = d; d = _mm_unpacklo_epi8(load3(row ), zero);
|
||||
|
||||
/* (p-a) == (a+b-c - a) == (b-c) */
|
||||
__m128i pa = _mm_sub_epi16(b,c);
|
||||
pa = _mm_sub_epi16(b,c);
|
||||
|
||||
/* (p-b) == (a+b-c - b) == (a-c) */
|
||||
__m128i pb = _mm_sub_epi16(a,c);
|
||||
pb = _mm_sub_epi16(a,c);
|
||||
|
||||
/* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
|
||||
__m128i pc = _mm_add_epi16(pa,pb);
|
||||
pc = _mm_add_epi16(pa,pb);
|
||||
|
||||
pa = abs_i16(pa); /* |p-a| */
|
||||
pb = abs_i16(pb); /* |p-b| */
|
||||
pc = abs_i16(pc); /* |p-c| */
|
||||
|
||||
__m128i smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
|
||||
smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
|
||||
|
||||
/* Paeth breaks ties favoring a over b over c. */
|
||||
__m128i nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
|
||||
nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
|
||||
if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
|
||||
c));
|
||||
|
||||
@ -331,13 +356,16 @@ void png_read_filter_row_paeth4_sse2(png_row_infop row_info, png_bytep row,
|
||||
* Here we zero b and d, which become c and a respectively at the start of
|
||||
* the loop.
|
||||
*/
|
||||
png_debug(1, "in png_read_filter_row_paeth4_sse2");
|
||||
png_size_t rb;
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i pa,pb,pc,smallest,nearest;
|
||||
__m128i c, b = zero,
|
||||
a, d = zero;
|
||||
|
||||
int rb = row_info->rowbytes;
|
||||
while (rb > 0) {
|
||||
png_debug(1, "in png_read_filter_row_paeth4_sse2");
|
||||
|
||||
rb = row_info->rowbytes+4;
|
||||
while (rb > 4) {
|
||||
/* It's easiest to do this math (particularly, deal with pc) with 16-bit
|
||||
* intermediates.
|
||||
*/
|
||||
@ -345,22 +373,22 @@ void png_read_filter_row_paeth4_sse2(png_row_infop row_info, png_bytep row,
|
||||
a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
|
||||
|
||||
/* (p-a) == (a+b-c - a) == (b-c) */
|
||||
__m128i pa = _mm_sub_epi16(b,c);
|
||||
pa = _mm_sub_epi16(b,c);
|
||||
|
||||
/* (p-b) == (a+b-c - b) == (a-c) */
|
||||
__m128i pb = _mm_sub_epi16(a,c);
|
||||
pb = _mm_sub_epi16(a,c);
|
||||
|
||||
/* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
|
||||
__m128i pc = _mm_add_epi16(pa,pb);
|
||||
pc = _mm_add_epi16(pa,pb);
|
||||
|
||||
pa = abs_i16(pa); /* |p-a| */
|
||||
pb = abs_i16(pb); /* |p-b| */
|
||||
pc = abs_i16(pc); /* |p-c| */
|
||||
|
||||
__m128i smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
|
||||
smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
|
||||
|
||||
/* Paeth breaks ties favoring a over b over c. */
|
||||
__m128i nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
|
||||
nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
|
||||
if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
|
||||
c));
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.30 - June 28, 2017
|
||||
libpng version 1.6.31 - July 27, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.30 - June 28, 2017
|
||||
libpng versions 0.97, January 1998, through 1.6.31 - July 27, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
|
||||
@ -1330,6 +1330,11 @@ in until png_read_end() has read the chunk data following the image.
|
||||
rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
rowbytes - number of bytes needed to hold a row
|
||||
This value, the bit_depth, color_type,
|
||||
and the number of channels can change
|
||||
if you use transforms such as
|
||||
png_set_expand(). See
|
||||
png_read_update_info(), below.
|
||||
|
||||
signature = png_get_signature(png_ptr, info_ptr);
|
||||
|
||||
@ -1448,6 +1453,11 @@ png_set_rgb_to_gray()).
|
||||
the single transparent color for
|
||||
non-paletted images (PNG_INFO_tRNS)
|
||||
|
||||
png_get_eXIf(png_ptr, info_ptr, &exif);
|
||||
(PNG_INFO_eXIf)
|
||||
|
||||
exif - Exif profile (array of png_byte)
|
||||
|
||||
png_get_hIST(png_ptr, info_ptr, &hist);
|
||||
(PNG_INFO_hIST)
|
||||
|
||||
@ -2493,6 +2503,7 @@ your application instead of by libpng, you can use
|
||||
PNG_INFO_gAMA, PNG_INFO_sBIT,
|
||||
PNG_INFO_cHRM, PNG_INFO_PLTE,
|
||||
PNG_INFO_tRNS, PNG_INFO_bKGD,
|
||||
PNG_INFO_eXIf,
|
||||
PNG_INFO_hIST, PNG_INFO_pHYs,
|
||||
PNG_INFO_oFFs, PNG_INFO_tIME,
|
||||
PNG_INFO_pCAL, PNG_INFO_sRGB,
|
||||
@ -3092,6 +3103,11 @@ width, height, bit_depth, and color_type must be the same in each call.
|
||||
single transparent color for
|
||||
non-paletted images (PNG_INFO_tRNS)
|
||||
|
||||
png_set_eXIf(png_ptr, info_ptr, exif);
|
||||
|
||||
hist - Exif profile (array of
|
||||
png_byte) (PNG_INFO_eXIf)
|
||||
|
||||
png_set_hIST(png_ptr, info_ptr, hist);
|
||||
|
||||
hist - histogram of palette (array of
|
||||
@ -5200,6 +5216,11 @@ is an error. Previously this requirement of the PNG specification was not
|
||||
enforced, and the palette was always limited to 256 entries. An over-length
|
||||
PLTE chunk found in an input PNG is silently truncated.
|
||||
|
||||
Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not
|
||||
attempt to decode the Exif profile; it simply returns a byte array
|
||||
containing the profile to the calling application which must do its own
|
||||
decoding.
|
||||
|
||||
XIII. Detecting libpng
|
||||
|
||||
The png_get_io_ptr() function has been present since libpng-0.88, has never
|
||||
@ -5383,7 +5404,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.6.30 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.31 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
|
43
libpng.3
43
libpng.3
@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "June 28, 2017"
|
||||
.TH LIBPNG 3 "July 27, 2017"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.30
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.31
|
||||
.SH SYNOPSIS
|
||||
\fB
|
||||
#include <png.h>\fP
|
||||
@ -97,6 +97,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.30
|
||||
|
||||
\fBpng_byte png_get_header_version (png_const_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fBpng_uint_32 png_get_eXIf (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fI*exif\fP\fB);\fP
|
||||
|
||||
\fBpng_uint_32 png_get_hIST (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP
|
||||
|
||||
\fBpng_uint_32 png_get_iCCP (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_charpp \fP\fIname\fP\fB, int \fP\fI*compression_type\fP\fB, png_bytepp \fP\fIprofile\fP\fB, png_uint_32 \fI*proflen\fP\fB);\fP
|
||||
@ -347,6 +349,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.30
|
||||
|
||||
\fBvoid png_set_gray_to_rgb (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fBvoid png_set_eXIf (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fIexif\fP\fB);\fP
|
||||
|
||||
\fBvoid png_set_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fIhist\fP\fB);\fP
|
||||
|
||||
\fBvoid png_set_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_const_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_const_bytep \fP\fIprofile\fP\fB, png_uint_32 \fIproflen\fP\fB);\fP
|
||||
@ -510,7 +514,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
|
||||
.SH LIBPNG.TXT
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.30 - June 28, 2017
|
||||
libpng version 1.6.31 - July 27, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
@ -521,7 +525,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.30 - June 28, 2017
|
||||
libpng versions 0.97, January 1998, through 1.6.31 - July 27, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
|
||||
@ -1840,6 +1844,11 @@ in until png_read_end() has read the chunk data following the image.
|
||||
rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
rowbytes - number of bytes needed to hold a row
|
||||
This value, the bit_depth, color_type,
|
||||
and the number of channels can change
|
||||
if you use transforms such as
|
||||
png_set_expand(). See
|
||||
png_read_update_info(), below.
|
||||
|
||||
signature = png_get_signature(png_ptr, info_ptr);
|
||||
|
||||
@ -1958,6 +1967,11 @@ png_set_rgb_to_gray()).
|
||||
the single transparent color for
|
||||
non-paletted images (PNG_INFO_tRNS)
|
||||
|
||||
png_get_eXIf(png_ptr, info_ptr, &exif);
|
||||
(PNG_INFO_eXIf)
|
||||
|
||||
exif - Exif profile (array of png_byte)
|
||||
|
||||
png_get_hIST(png_ptr, info_ptr, &hist);
|
||||
(PNG_INFO_hIST)
|
||||
|
||||
@ -3003,6 +3017,7 @@ your application instead of by libpng, you can use
|
||||
PNG_INFO_gAMA, PNG_INFO_sBIT,
|
||||
PNG_INFO_cHRM, PNG_INFO_PLTE,
|
||||
PNG_INFO_tRNS, PNG_INFO_bKGD,
|
||||
PNG_INFO_eXIf,
|
||||
PNG_INFO_hIST, PNG_INFO_pHYs,
|
||||
PNG_INFO_oFFs, PNG_INFO_tIME,
|
||||
PNG_INFO_pCAL, PNG_INFO_sRGB,
|
||||
@ -3602,6 +3617,11 @@ width, height, bit_depth, and color_type must be the same in each call.
|
||||
single transparent color for
|
||||
non-paletted images (PNG_INFO_tRNS)
|
||||
|
||||
png_set_eXIf(png_ptr, info_ptr, exif);
|
||||
|
||||
hist - Exif profile (array of
|
||||
png_byte) (PNG_INFO_eXIf)
|
||||
|
||||
png_set_hIST(png_ptr, info_ptr, hist);
|
||||
|
||||
hist - histogram of palette (array of
|
||||
@ -5710,6 +5730,11 @@ is an error. Previously this requirement of the PNG specification was not
|
||||
enforced, and the palette was always limited to 256 entries. An over-length
|
||||
PLTE chunk found in an input PNG is silently truncated.
|
||||
|
||||
Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not
|
||||
attempt to decode the Exif profile; it simply returns a byte array
|
||||
containing the profile to the calling application which must do its own
|
||||
decoding.
|
||||
|
||||
.SH XIII. Detecting libpng
|
||||
|
||||
The png_get_io_ptr() function has been present since libpng-0.88, has never
|
||||
@ -5893,7 +5918,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.6.30 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.31 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
@ -5995,7 +6020,7 @@ the first widely used release:
|
||||
...
|
||||
1.5.28 15 10528 15.so.15.28[.0]
|
||||
...
|
||||
1.6.30 16 10630 16.so.16.30[.0]
|
||||
1.6.31 16 10631 16.so.16.31[.0]
|
||||
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
@ -6051,7 +6076,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.6.30 - June 28, 2017:
|
||||
Libpng version 1.6.31 - July 27, 2017:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||
|
||||
@ -6076,7 +6101,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.30, June 28, 2017 are
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
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
|
||||
@ -6204,7 +6229,7 @@ files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
June 28, 2017
|
||||
July 27, 2017
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
@ -6,6 +6,7 @@ includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||
Name: libpng
|
||||
Description: Loads and saves PNG files
|
||||
Version: @PNGLIB_VERSION@
|
||||
Requires: zlib
|
||||
Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||
Libs.private: @LIBS@
|
||||
Cflags: -I${includedir}
|
||||
|
@ -1,6 +1,6 @@
|
||||
.TH LIBPNGPF 3 "April 1, 2017"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.30
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.31
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB\fB#include \fI\fI"pngpriv.h"
|
||||
|
71
png.c
71
png.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.30 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 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.)
|
||||
@ -14,7 +14,27 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_30 Your_png_h_is_not_version_1_6_30;
|
||||
typedef png_libpng_version_1_6_31 Your_png_h_is_not_version_1_6_31;
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* The version tests may need to be added to, but the problem warning has
|
||||
* consistently been fixed in GCC versions which obtain wide-spread release.
|
||||
* The problem is that many versions of GCC rearrange comparison expressions in
|
||||
* the optimizer in such a way that the results of the comparison will change
|
||||
* if signed integer overflow occurs. Such comparisons are not permitted in
|
||||
* ANSI C90, however GCC isn't clever enough to work out that that do not occur
|
||||
* below in png_ascii_from_fp and png_muldiv, so it produces a warning with
|
||||
* -Wextra. Unfortunately this is highly dependent on the optimizer and the
|
||||
* machine architecture so the warning comes and goes unpredictably and is
|
||||
* impossible to "fix", even were that a good idea.
|
||||
*/
|
||||
#if __GNUC__ == 7 && __GNUC_MINOR__ == 1
|
||||
#define GCC_STRICT_OVERFLOW 1
|
||||
#endif /* GNU 7.1.x */
|
||||
#endif /* GNU */
|
||||
#ifndef GCC_STRICT_OVERFLOW
|
||||
#define GCC_STRICT_OVERFLOW 0
|
||||
#endif
|
||||
|
||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||
* of the PNG file signature. If the PNG data is embedded into another
|
||||
@ -595,6 +615,16 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
/* Free any eXIf entry */
|
||||
if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->exif);
|
||||
info_ptr->exif = NULL;
|
||||
info_ptr->valid &= ~PNG_INFO_eXIf;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
/* Free any hIST entry */
|
||||
if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0)
|
||||
@ -776,14 +806,14 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.30 - June 28, 2017" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.31 - July 27, 2017" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
|
||||
PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE;
|
||||
# else
|
||||
return "libpng version 1.6.30 - June 28, 2017\
|
||||
return "libpng version 1.6.31 - July 27, 2017\
|
||||
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
@ -2857,6 +2887,14 @@ png_pow10(int power)
|
||||
/* Function to format a floating point value in ASCII with a given
|
||||
* precision.
|
||||
*/
|
||||
#if GCC_STRICT_OVERFLOW
|
||||
#pragma GCC diagnostic push
|
||||
/* The problem arises below with exp_b10, which can never overflow because it
|
||||
* comes, originally, from frexp and is therefore limited to a range which is
|
||||
* typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
|
||||
*/
|
||||
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
void /* PRIVATE */
|
||||
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
double fp, unsigned int precision)
|
||||
@ -2946,7 +2984,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
*/
|
||||
if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */
|
||||
{
|
||||
czero = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */
|
||||
czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */
|
||||
exp_b10 = 0; /* Dot added below before first output. */
|
||||
}
|
||||
else
|
||||
@ -3087,7 +3125,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
|
||||
/* Check for an exponent, if we don't need one we are
|
||||
* done and just need to terminate the string. At
|
||||
* this point exp_b10==(-1) is effectively if flag - it got
|
||||
* this point exp_b10==(-1) is effectively a flag - it got
|
||||
* to '-1' because of the decrement after outputting
|
||||
* the decimal point above (the exponent required is
|
||||
* *not* -1!)
|
||||
@ -3101,7 +3139,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
* zeros were *not* output, so this doesn't increase
|
||||
* the output count.
|
||||
*/
|
||||
while (--exp_b10 >= 0) *ascii++ = 48;
|
||||
while (exp_b10-- > 0) *ascii++ = 48;
|
||||
|
||||
*ascii = 0;
|
||||
|
||||
@ -3131,11 +3169,11 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
if (exp_b10 < 0)
|
||||
{
|
||||
*ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */
|
||||
uexp_b10 = (unsigned int)(-exp_b10);
|
||||
uexp_b10 = 0U-exp_b10;
|
||||
}
|
||||
|
||||
else
|
||||
uexp_b10 = (unsigned int)exp_b10;
|
||||
uexp_b10 = 0U+exp_b10;
|
||||
|
||||
cdigits = 0;
|
||||
|
||||
@ -3178,6 +3216,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
/* Here on buffer too small. */
|
||||
png_error(png_ptr, "ASCII conversion buffer too small");
|
||||
}
|
||||
#if GCC_STRICT_OVERFLOW
|
||||
#pragma GCC diagnostic pop
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
|
||||
# endif /* FLOATING_POINT */
|
||||
|
||||
@ -3291,6 +3332,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
|
||||
* the nearest .00001). Overflow and divide by zero are signalled in
|
||||
* the result, a boolean - true on success, false on overflow.
|
||||
*/
|
||||
#if GCC_STRICT_OVERFLOW /* from above */
|
||||
/* It is not obvious which comparison below gets optimized in such a way that
|
||||
* signed overflow would change the result; looking through the code does not
|
||||
* reveal any tests which have the form GCC complains about, so presumably the
|
||||
* optimizer is moving an add or subtract into the 'if' somewhere.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
int
|
||||
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
||||
png_int_32 divisor)
|
||||
@ -3405,6 +3455,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
||||
|
||||
return 0;
|
||||
}
|
||||
#if GCC_STRICT_OVERFLOW
|
||||
#pragma GCC diagnostic pop
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
#endif /* READ_GAMMA || INCH_CONVERSIONS */
|
||||
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
|
||||
|
38
png.h
38
png.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.30, June 28, 2017
|
||||
* libpng version 1.6.31, July 27, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -12,7 +12,7 @@
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.30, June 28, 2017:
|
||||
* libpng versions 0.97, January 1998, through 1.6.31, July 27, 2017:
|
||||
* Glenn Randers-Pehrson.
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
@ -25,7 +25,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.30, June 28, 2017 are
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
* 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
|
||||
@ -213,7 +213,7 @@
|
||||
* ...
|
||||
* 1.5.28 15 10527 15.so.15.28[.0]
|
||||
* ...
|
||||
* 1.6.30 16 10630 16.so.16.30[.0]
|
||||
* 1.6.31 16 10631 16.so.16.31[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -241,13 +241,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* June 28, 2017
|
||||
* July 27, 2017
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.6.30 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.31 are Y2K compliant. It is my belief that
|
||||
* earlier versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
@ -309,8 +309,8 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.30"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.30 - June 28, 2017\n"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.31"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.31 - July 27, 2017\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -318,7 +318,7 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 30
|
||||
#define PNG_LIBPNG_VER_RELEASE 31
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
@ -349,7 +349,7 @@
|
||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10630 /* 1.6.30 */
|
||||
#define PNG_LIBPNG_VER 10631 /* 1.6.31 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@ -459,7 +459,7 @@ extern "C" {
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_30;
|
||||
typedef char* png_libpng_version_1_6_31;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
@ -776,6 +776,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
||||
#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
|
||||
|
||||
/* This is used for the transformation routines, as some of them
|
||||
* change these values for the row. It also should enable using
|
||||
@ -1788,7 +1789,8 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
|
||||
#define PNG_FREE_PLTE 0x1000U
|
||||
#define PNG_FREE_TRNS 0x2000U
|
||||
#define PNG_FREE_TEXT 0x4000U
|
||||
#define PNG_FREE_ALL 0x7fffU
|
||||
#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
|
||||
#define PNG_FREE_ALL 0xffffU
|
||||
#define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
@ -2007,6 +2009,13 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
|
||||
png_fixed_point int_blue_Z))
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_bytep *exif));
|
||||
PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, const png_bytep exif));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_gAMA_SUPPORTED
|
||||
PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
|
||||
png_const_inforp info_ptr, double *file_gamma))
|
||||
@ -2025,9 +2034,6 @@ PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr,
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_16p *hist));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_const_uint_16p hist));
|
||||
#endif
|
||||
@ -3253,7 +3259,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
|
||||
* one to use is one more than this.)
|
||||
*/
|
||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||
PNG_EXPORT_LAST_ORDINAL(245);
|
||||
PNG_EXPORT_LAST_ORDINAL(247);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.30, June 28, 2017
|
||||
* libpng version 1.6.31, July 27, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 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.)
|
||||
*
|
||||
@ -163,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
||||
case PNG_NUMBER_FORMAT_02u:
|
||||
/* Expects at least 2 digits. */
|
||||
mincount = 2;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case PNG_NUMBER_FORMAT_u:
|
||||
*--end = digits[number % 10];
|
||||
@ -173,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
||||
case PNG_NUMBER_FORMAT_02x:
|
||||
/* This format expects at least two digits */
|
||||
mincount = 2;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case PNG_NUMBER_FORMAT_x:
|
||||
*--end = digits[number & 0xf];
|
||||
|
18
pngget.c
18
pngget.c
@ -773,6 +773,24 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
png_bytep *exif)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "eXIf");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
|
||||
{
|
||||
*exif = info_ptr->exif;
|
||||
return (PNG_INFO_eXIf);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
@ -185,6 +185,11 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
int num_exif;
|
||||
png_bytep exif;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
/* The hIST chunk contains the relative frequency or importance of the
|
||||
* various palette entries, so that a viewer can intelligently select a
|
||||
|
41
pngpriv.h
41
pngpriv.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.30 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 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.)
|
||||
@ -35,7 +35,9 @@
|
||||
* Windows/Visual Studio) there is no effect; the OS specific tests below are
|
||||
* still required (as of 2011-05-02.)
|
||||
*/
|
||||
#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
|
||||
#ifndef _POSIX_SOURCE
|
||||
# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
|
||||
#endif
|
||||
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* Standard library headers not required by png.h: */
|
||||
@ -452,6 +454,21 @@
|
||||
# define png_fixed_error(s1,s2) png_err(s1)
|
||||
#endif
|
||||
|
||||
/* Some fixed point APIs are still required even if not exported because
|
||||
* they get used by the corresponding floating point APIs. This magic
|
||||
* deals with this:
|
||||
*/
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
# define PNGFAPI PNGAPI
|
||||
#else
|
||||
# define PNGFAPI /* PRIVATE */
|
||||
#endif
|
||||
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* Other defines specific to compilers can go here. Try to keep
|
||||
* them inside an appropriate ifdef/endif pair for portability.
|
||||
*/
|
||||
|
||||
/* C allows up-casts from (void*) to any pointer and (const void*) to any
|
||||
* pointer to a const object. C++ regards this as a type error and requires an
|
||||
* explicit, static, cast and provides the static_cast<> rune to ensure that
|
||||
@ -480,20 +497,6 @@
|
||||
# define png_aligncastconst(type, value) ((const void*)(value))
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Some fixed point APIs are still required even if not exported because
|
||||
* they get used by the corresponding floating point APIs. This magic
|
||||
* deals with this:
|
||||
*/
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
# define PNGFAPI PNGAPI
|
||||
#else
|
||||
# define PNGFAPI /* PRIVATE */
|
||||
#endif
|
||||
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* Other defines specific to compilers can go here. Try to keep
|
||||
* them inside an appropriate ifdef/endif pair for portability.
|
||||
*/
|
||||
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
|
||||
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
|
||||
/* png.c requires the following ANSI-C constants if the conversion of
|
||||
@ -839,6 +842,7 @@
|
||||
#define png_PLTE PNG_U32( 80, 76, 84, 69)
|
||||
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
||||
#define png_cHRM PNG_U32( 99, 72, 82, 77)
|
||||
#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
|
||||
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
|
||||
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
||||
#define png_gIFg PNG_U32(103, 73, 70, 103)
|
||||
@ -1438,6 +1442,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_gAMA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
|
15
pngread.c
15
pngread.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 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.)
|
||||
*
|
||||
@ -1883,7 +1883,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
{
|
||||
case 4:
|
||||
entry[afirst ? 0 : 3] = (png_uint_16)alpha;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 3:
|
||||
if (alpha < 65535)
|
||||
@ -1905,7 +1905,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
|
||||
case 2:
|
||||
entry[1 ^ afirst] = (png_uint_16)alpha;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 1:
|
||||
if (alpha < 65535)
|
||||
@ -1934,6 +1934,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
{
|
||||
case 4:
|
||||
entry[afirst ? 0 : 3] = (png_byte)alpha;
|
||||
/* FALLTHROUGH */
|
||||
case 3:
|
||||
entry[afirst + (2 ^ bgr)] = (png_byte)blue;
|
||||
entry[afirst + 1] = (png_byte)green;
|
||||
@ -1942,6 +1943,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
||||
|
||||
case 2:
|
||||
entry[1 ^ afirst] = (png_byte)alpha;
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
entry[afirst] = (png_byte)green;
|
||||
break;
|
||||
@ -2861,7 +2863,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
case P_sRGB:
|
||||
/* Change to 8-bit sRGB */
|
||||
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case P_FILE:
|
||||
if (png_ptr->bit_depth > 8)
|
||||
@ -3179,8 +3181,7 @@ png_image_read_colormapped(png_voidp argument)
|
||||
image->colormap_entries == 244 /* 216 + 1 + 27 */)
|
||||
break;
|
||||
|
||||
/* goto bad_output; */
|
||||
/* FALL THROUGH */
|
||||
goto bad_output;
|
||||
|
||||
default:
|
||||
bad_output:
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.6.30 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 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.)
|
||||
@ -49,6 +49,7 @@ png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action)
|
||||
case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */
|
||||
png_warning(png_ptr,
|
||||
"Can't discard critical data on CRC error");
|
||||
/* FALLTHROUGH */
|
||||
case PNG_CRC_ERROR_QUIT: /* Error/quit */
|
||||
|
||||
case PNG_CRC_DEFAULT:
|
||||
@ -1253,7 +1254,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
|
||||
default:
|
||||
|
||||
case 8:
|
||||
/* FALL THROUGH (Already 8 bits) */
|
||||
/* FALLTHROUGH */ /* (Already 8 bits) */
|
||||
|
||||
case 16:
|
||||
/* Already a full 16 bits */
|
||||
|
44
pngrutil.c
44
pngrutil.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.30 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 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.)
|
||||
@ -2009,6 +2009,44 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
unsigned int i;
|
||||
png_bytep eXIf_buf;
|
||||
|
||||
png_debug(1, "in png_handle_eXIf");
|
||||
|
||||
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
|
||||
png_chunk_error(png_ptr, "missing IHDR");
|
||||
|
||||
else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_eXIf) != 0)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "duplicate");
|
||||
return;
|
||||
}
|
||||
|
||||
eXIf_buf = png_voidcast(png_bytep,
|
||||
png_malloc_warn(png_ptr, length));
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
png_byte buf[1];
|
||||
png_crc_read(png_ptr, buf, 1);
|
||||
eXIf_buf[i] = buf[0];
|
||||
}
|
||||
|
||||
if (png_crc_finish(png_ptr, 0) != 0)
|
||||
return;
|
||||
|
||||
info_ptr->num_exif = length;
|
||||
|
||||
png_set_eXIf(png_ptr, info_ptr, eXIf_buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_hIST_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
@ -2978,7 +3016,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
||||
case 2:
|
||||
png_ptr->user_chunk_cache_max = 1;
|
||||
png_chunk_benign_error(png_ptr, "no space in chunk cache");
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
/* NOTE: prior to 1.6.0 this case resulted in an unknown critical
|
||||
* chunk being skipped, now there will be a hard error below.
|
||||
@ -2987,7 +3025,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
default: /* not at limit */
|
||||
--(png_ptr->user_chunk_cache_max);
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 0: /* no limit */
|
||||
# endif /* USER_LIMITS */
|
||||
/* Here when the limit isn't reached or when limits are compiled
|
||||
|
35
pngset.c
35
pngset.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.30 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.30 [June 28, 2017]
|
||||
* Copyright (c) 1998-2017 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.)
|
||||
@ -134,6 +134,39 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
|
||||
|
||||
#endif /* cHRM */
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
const png_bytep eXIf_buf)
|
||||
{
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function", "eXIf");
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_EXIF, 0);
|
||||
|
||||
info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr,
|
||||
info_ptr->num_exif));
|
||||
|
||||
if (info_ptr->exif == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Insufficient memory for eXIf chunk data");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
info_ptr->free_me |= PNG_FREE_EXIF;
|
||||
|
||||
for (i = 0; i < info_ptr->num_exif; i++)
|
||||
info_ptr->exif[i] = eXIf_buf[i];
|
||||
|
||||
info_ptr->valid |= PNG_INFO_eXIf;
|
||||
}
|
||||
#endif /* eXIf */
|
||||
|
||||
#ifdef PNG_gAMA_SUPPORTED
|
||||
void PNGFAPI
|
||||
png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
@ -479,5 +479,8 @@ struct png_struct_def
|
||||
png_colorspace colorspace;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* New member added in libpng-1.6.31 */
|
||||
int num_exif;
|
||||
};
|
||||
#endif /* PNGSTRUCT_H */
|
||||
|
18
pngtest.c
18
pngtest.c
@ -1192,6 +1192,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
{
|
||||
png_bytep exif;
|
||||
|
||||
if (png_get_eXIf(read_ptr, read_info_ptr, &exif) != 0)
|
||||
png_set_eXIf(write_ptr, write_info_ptr, exif);
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
{
|
||||
png_uint_16p hist;
|
||||
@ -1530,6 +1538,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
{
|
||||
png_bytep exif;
|
||||
|
||||
if (png_get_eXIf(read_ptr, end_info_ptr, &exif) != 0)
|
||||
png_set_eXIf(write_ptr, write_end_info_ptr, exif);
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_tIME_SUPPORTED
|
||||
{
|
||||
png_timep mod_time;
|
||||
@ -2088,4 +2104,4 @@ main(void)
|
||||
#endif
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_30 Your_png_h_is_not_version_1_6_30;
|
||||
typedef png_libpng_version_1_6_31 Your_png_h_is_not_version_1_6_31;
|
||||
|
BIN
pngtest.png
BIN
pngtest.png
Binary file not shown.
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.6 KiB |
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.6.30 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.30 [June 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 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.)
|
||||
|
10
pngwrite.c
10
pngwrite.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 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.)
|
||||
*
|
||||
@ -1007,8 +1007,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
|
||||
case 5:
|
||||
case 6:
|
||||
case 7: png_app_error(png_ptr, "Unknown row filter for method 0");
|
||||
/* FALL THROUGH */
|
||||
#endif /* WRITE_FILTER */
|
||||
/* FALLTHROUGH */
|
||||
case PNG_FILTER_VALUE_NONE:
|
||||
png_ptr->do_filter = PNG_FILTER_NONE; break;
|
||||
|
||||
@ -1875,7 +1875,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
tRNS[i] = entry[afirst ? 0 : 3];
|
||||
if (tRNS[i] < 255)
|
||||
num_trans = i+1;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 3:
|
||||
palette[i].blue = entry[afirst + (2 ^ bgr)];
|
||||
palette[i].green = entry[afirst + 1];
|
||||
@ -1886,7 +1886,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
tRNS[i] = entry[1 ^ afirst];
|
||||
if (tRNS[i] < 255)
|
||||
num_trans = i+1;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
palette[i].blue = palette[i].red = palette[i].green =
|
||||
entry[afirst];
|
||||
|
31
pngwutil.c
31
pngwutil.c
@ -1473,6 +1473,37 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||
/* Write the Exif data */
|
||||
void /* PRIVATE */
|
||||
png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif)
|
||||
{
|
||||
int i;
|
||||
png_byte buf[3];
|
||||
|
||||
png_debug(1, "in png_write_eXIf");
|
||||
|
||||
if (num_exif > (int)png_ptr->num_exif)
|
||||
{
|
||||
png_debug2(3, "num_exif = %d, png_ptr->num_exif = %d", num_exif,
|
||||
png_ptr->num_exif);
|
||||
|
||||
png_warning(png_ptr, "Invalid number of exif bytes specified");
|
||||
return;
|
||||
}
|
||||
|
||||
png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif));
|
||||
|
||||
for (i = 0; i < num_exif; i++)
|
||||
{
|
||||
buf[i] = exif[i];
|
||||
png_write_chunk_data(png_ptr, buf, (png_size_t)1);
|
||||
}
|
||||
|
||||
png_write_chunk_end(png_ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_hIST_SUPPORTED
|
||||
/* Write the histogram */
|
||||
void /* PRIVATE */
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
VisualStudio instructions
|
||||
|
||||
libpng version 1.6.30 - June 28, 2017
|
||||
libpng version 1.6.31 - July 27, 2017
|
||||
|
||||
Copyright (c) 2010,2013,2015 Glenn Randers-Pehrson
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!--
|
||||
* zlib.props - location of zlib source
|
||||
*
|
||||
* libpng version 1.6.30 - June 28, 2017
|
||||
* libpng version 1.6.31 - July 27, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
|
@ -1,9 +1,11 @@
|
||||
|
||||
Makefiles for libpng version 1.6.30 - June 28, 2017
|
||||
Makefiles for libpng version 1.6.31 - July 27, 2017
|
||||
|
||||
pnglibconf.h.prebuilt => Stores configuration settings
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng16.so.16.1.6.30)
|
||||
(gcc, creates libpng16.so.16.1.6.31)
|
||||
makefile.linux-opt=> Linux/ELF makefile with hardware optimizations on
|
||||
(gcc, creates libpng16.so.16.1.6.31)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
ansi2knr (Requires ansi2knr.c from
|
||||
@ -33,12 +35,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
|
||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.sggcc => Silicon Graphics (gcc,
|
||||
creates libpng16.so.16.1.6.30)
|
||||
creates libpng16.so.16.1.6.31)
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||
creates libpng16.so.16.1.6.30)
|
||||
creates libpng16.so.16.1.6.31)
|
||||
makefile.so9 => Solaris 9 makefile (gcc,
|
||||
creates libpng16.so.16.1.6.30)
|
||||
creates libpng16.so.16.1.6.31)
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||
|
@ -21,7 +21,7 @@ PNG_DFN "OS2 DESCRIPTION "PNG image compression library""
|
||||
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
|
||||
PNG_DFN ""
|
||||
PNG_DFN "EXPORTS"
|
||||
PNG_DFN ";Version 1.6.30"
|
||||
PNG_DFN ";Version 1.6.31"
|
||||
|
||||
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
||||
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
# Modeled after libxml-config.
|
||||
|
||||
version=1.6.30
|
||||
version=1.6.31
|
||||
prefix=""
|
||||
libdir=""
|
||||
libs=""
|
||||
|
@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
|
||||
|
||||
Name: libpng
|
||||
Description: Loads and saves PNG files
|
||||
Version: 1.6.30
|
||||
Version: 1.6.31
|
||||
Libs: -L${libdir} -lpng16
|
||||
Cflags: -I${includedir}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
VERMAJ = 1
|
||||
VERMIN = 6
|
||||
VERMIC = 30
|
||||
VERMIC = 31
|
||||
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
||||
NAME = libpng
|
||||
PACKAGE = $(NAME)-$(VER)
|
||||
|
@ -10,7 +10,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
RELEASE = 30
|
||||
RELEASE = 31
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).so
|
||||
|
265
scripts/makefile.linux-opt
Normal file
265
scripts/makefile.linux-opt
Normal file
@ -0,0 +1,265 @@
|
||||
# makefile for libpng.a and libpng16.so on Linux ELF with gcc
|
||||
# Copyright (C) 1998,1999,2002,2006,2008,2010-2014,2017 Greg Roelofs and
|
||||
# Glenn Randers-Pehrson
|
||||
# Copyright (C) 1996,1997 Andreas Dilger
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
||||
# Library name:
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
RELEASE = 31
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).so
|
||||
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
|
||||
LIBSOREL=$(LIBSOMAJ).$(RELEASE)
|
||||
OLDSO=libpng.so
|
||||
|
||||
# Utilities:
|
||||
AR_RC=ar rc
|
||||
CC=gcc
|
||||
MKDIR_P=mkdir -p
|
||||
LN_SF=ln -sf
|
||||
RANLIB=ranlib
|
||||
CP=cp
|
||||
RM_F=/bin/rm -f
|
||||
|
||||
# where "make install" puts libpng16.a, libpng16.so*,
|
||||
# libpng16/png.h, libpng16/pngconf.h, and libpng16/pnglibconf.h
|
||||
# Prefix must be a full pathname.
|
||||
prefix=/usr/local
|
||||
exec_prefix=$(prefix)
|
||||
|
||||
# Where the zlib library and include files are located.
|
||||
#ZLIBLIB=/usr/local/lib
|
||||
#ZLIBINC=/usr/local/include
|
||||
ZLIBLIB=../zlib
|
||||
ZLIBINC=../zlib
|
||||
|
||||
ALIGN=
|
||||
# for i386:
|
||||
#ALIGN=-malign-loops=2 -malign-functions=2
|
||||
|
||||
#WARNMORE=-Wwrite-strings -Wpointer-arith \
|
||||
# -Wmissing-declarations -Wtraditional -Wcast-align \
|
||||
# -Wstrict-prototypes -Wmissing-prototypes
|
||||
|
||||
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
||||
|
||||
CPPFLAGS=-I$(ZLIBINC)
|
||||
CPPFLAGS += -DPNG_ARM_NEON
|
||||
CPPFLAGS += -DPNG_MIPS_MSA
|
||||
CPPFLAGS += -DPNG_INTEL_SSE
|
||||
CPPFLAGS += -DPNG_POWERPC_VSX
|
||||
CPPFLAGS+=-ansi -pedantic -Wextra -Wall -Wshadow -Wno-sign-conversion
|
||||
CPPFLAGS+=-W -Wall -Wconversion $(ALIGN)
|
||||
# CPPFLAGS+=$(WARNMORE)
|
||||
CFLAGS= -O3 -funroll-loops
|
||||
|
||||
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
|
||||
LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
|
||||
|
||||
INCPATH=$(prefix)/include
|
||||
LIBPATH=$(exec_prefix)/lib
|
||||
MANPATH=$(prefix)/man
|
||||
BINPATH=$(exec_prefix)/bin
|
||||
|
||||
# override DESTDIR= on the make install command line to easily support
|
||||
# installing into a temporary location. Example:
|
||||
#
|
||||
# make install DESTDIR=/tmp/build/libpng
|
||||
#
|
||||
# If you're going to install into a temporary location
|
||||
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
|
||||
# you execute make install.
|
||||
DESTDIR=
|
||||
|
||||
DB=$(DESTDIR)$(BINPATH)
|
||||
DI=$(DESTDIR)$(INCPATH)
|
||||
DL=$(DESTDIR)$(LIBPATH)
|
||||
DM=$(DESTDIR)$(MANPATH)
|
||||
|
||||
# Pre-built configuration
|
||||
# See scripts/pnglibconf.mak for more options
|
||||
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||
|
||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||
pngwtran.o pngmem.o pngerror.o pngpread.o \
|
||||
arm/arm_init.o arm/filter_neon_intrinsics.o \
|
||||
mips/mips_init.o mips/filter_msa_intrinsics.o \
|
||||
intel/intel_init.o intel/filter_sse2_intrinsics.o\
|
||||
powerpc/powerpc_init.o powerpc/filter_vsx_intrinsics.o
|
||||
|
||||
OBJSDLL = $(OBJS:.o=.pic.o)
|
||||
|
||||
.SUFFIXES: .c .o .pic.o
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
.c.pic.o:
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c
|
||||
|
||||
all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
|
||||
|
||||
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||
|
||||
libpng.a: $(OBJS)
|
||||
$(AR_RC) $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
libpng.pc:
|
||||
cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
|
||||
-e s!@exec_prefix@!$(exec_prefix)! \
|
||||
-e s!@libdir@!$(LIBPATH)! \
|
||||
-e s!@includedir@!$(INCPATH)! \
|
||||
-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
|
||||
|
||||
libpng-config:
|
||||
( cat scripts/libpng-config-head.in; \
|
||||
echo prefix=\"$(prefix)\"; \
|
||||
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
||||
echo L_opts=\"-L$(LIBPATH)\"; \
|
||||
echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
|
||||
echo libs=\"-lpng16 -lz -lm\"; \
|
||||
cat scripts/libpng-config-body.in ) > libpng-config
|
||||
chmod +x libpng-config
|
||||
|
||||
$(LIBSO): $(LIBSOMAJ)
|
||||
$(LN_SF) $(LIBSOMAJ) $(LIBSO)
|
||||
|
||||
$(LIBSOMAJ): $(OBJSDLL)
|
||||
$(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
|
||||
|
||||
pngtest: pngtest.o $(LIBSO)
|
||||
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||
|
||||
pngtest-static: pngtest.o libpng.a
|
||||
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
|
||||
|
||||
test: pngtest pngtest-static
|
||||
@echo ""
|
||||
@echo " Running pngtest dynamically linked with $(LIBSO):"
|
||||
@echo ""
|
||||
./pngtest
|
||||
@echo ""
|
||||
@echo " Running pngtest statically linked with libpng.a:"
|
||||
@echo ""
|
||||
./pngtest-static
|
||||
|
||||
install-headers: png.h pngconf.h pnglibconf.h
|
||||
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
||||
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
||||
cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
|
||||
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
|
||||
-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
|
||||
-@$(RM_F) $(DI)/libpng
|
||||
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
|
||||
|
||||
install-static: install-headers libpng.a
|
||||
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
||||
cp libpng.a $(DL)/$(LIBNAME).a
|
||||
chmod 644 $(DL)/$(LIBNAME).a
|
||||
-@$(RM_F) $(DL)/libpng.a
|
||||
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
|
||||
|
||||
install-shared: install-headers $(LIBSOMAJ) libpng.pc
|
||||
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
||||
-@$(RM_F) $(DL)/$(LIBSO)
|
||||
-@$(RM_F) $(DL)/$(LIBSOREL)
|
||||
-@$(RM_F) $(DL)/$(OLDSO)
|
||||
cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
|
||||
chmod 755 $(DL)/$(LIBSOREL)
|
||||
(cd $(DL); \
|
||||
$(LN_SF) $(LIBSOREL) $(LIBSO); \
|
||||
$(LN_SF) $(LIBSO) $(OLDSO))
|
||||
|
||||
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
|
||||
-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
|
||||
-@$(RM_F) $(DL)/pkgconfig/libpng.pc
|
||||
cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
|
||||
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
|
||||
(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
|
||||
|
||||
install-man: libpng.3 libpngpf.3 png.5
|
||||
-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
|
||||
-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
|
||||
-@$(RM_F) $(DM)/man3/libpng.3
|
||||
-@$(RM_F) $(DM)/man3/libpngpf.3
|
||||
cp libpng.3 $(DM)/man3
|
||||
cp libpngpf.3 $(DM)/man3
|
||||
-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
|
||||
-@$(RM_F) $(DM)/man5/png.5
|
||||
cp png.5 $(DM)/man5
|
||||
|
||||
install-config: libpng-config
|
||||
-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
|
||||
-@$(RM_F) $(DB)/libpng-config
|
||||
-@$(RM_F) $(DB)/$(LIBNAME)-config
|
||||
cp libpng-config $(DB)/$(LIBNAME)-config
|
||||
chmod 755 $(DB)/$(LIBNAME)-config
|
||||
(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
|
||||
|
||||
install: install-static install-shared install-man install-config
|
||||
|
||||
# If you installed in $(DESTDIR), test-installed won't work until you
|
||||
# move the library to its final location. Use test-dd to test it
|
||||
# before then.
|
||||
|
||||
test-dd:
|
||||
echo
|
||||
echo Testing installed dynamic shared library in $(DL).
|
||||
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
|
||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
./pngtestd pngtest.png
|
||||
|
||||
test-installed:
|
||||
$(CC) $(CPPFLAGS) \
|
||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||
./pngtesti pngtest.png
|
||||
|
||||
clean:
|
||||
$(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
|
||||
$(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
|
||||
libpng.pc pnglibconf.h
|
||||
|
||||
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||
writelock:
|
||||
chmod a-w *.[ch35] $(DOCS) scripts/*
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||
arm/arm_init.o arm/arm_init.o: pngpriv.h
|
||||
arm/filter_neon_intrinsics.o arm/filter_neon_intrinsics.pic.o: pngpriv.h
|
||||
mips/mips_init.o mips/mips_init.pic.o: pngpriv.h
|
||||
mips/filter_msa_intrinsics.o mips/filter_msa_intrinsics.pic.: pngpriv.h
|
||||
intel/intel_init.o intel/intel_init.pic.: pngpriv.h
|
||||
intel/filter_sse2_intrinsics.o intel/filter_sse2_intrinsics.pic.: pngpriv.h
|
||||
powerpc/powerpc_init.o powerpc/powerpc_init.pic.: pngpriv.h
|
||||
powerpc/filter_vsx_intrinsics.o powerpc/filter_vsx_intrinsics.pic.: pngpriv.h
|
||||
|
||||
pngtest.o: png.h pngconf.h pnglibconf.h
|
@ -18,7 +18,7 @@ exec_prefix=$(prefix)
|
||||
# Library name:
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
RELEASE = 30
|
||||
RELEASE = 31
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).dll
|
||||
|
@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng16
|
||||
|
||||
LIB= png16
|
||||
SHLIB_MAJOR= 0
|
||||
SHLIB_MINOR= 1.6.30
|
||||
SHLIB_MINOR= 1.6.31
|
||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||
|
@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
|
||||
|
||||
LIB= png
|
||||
SHLIB_MAJOR= 16
|
||||
SHLIB_MINOR= 1.6.30
|
||||
SHLIB_MINOR= 1.6.31
|
||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||
|
@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
|
||||
MANDIR= ${PREFIX}/man/cat
|
||||
|
||||
SHLIB_MAJOR= 16
|
||||
SHLIB_MINOR= 1.6.30
|
||||
SHLIB_MINOR= 1.6.31
|
||||
|
||||
LIB= png
|
||||
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
|
||||
|
@ -741,6 +741,8 @@ setting IDAT_READ_SIZE default PNG_ZBUF_SIZE
|
||||
# Ancillary chunks
|
||||
chunk bKGD
|
||||
chunk cHRM enables COLORSPACE
|
||||
# enable eXIf only after chunk is approved
|
||||
chunk eXIf
|
||||
chunk gAMA enables GAMMA
|
||||
chunk hIST
|
||||
chunk iCCP enables COLORSPACE, GAMMA
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* libpng 1.6.30 STANDARD API DEFINITION */
|
||||
/* libpng 1.6.31 STANDARD API DEFINITION */
|
||||
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* Libpng version 1.6.30 - June 28, 2017 */
|
||||
/* Libpng version 1.6.31 - July 27, 2017 */
|
||||
|
||||
/* Copyright (c) 1998-2017 Glenn Randers-Pehrson */
|
||||
|
||||
@ -84,6 +84,7 @@
|
||||
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
#define PNG_READ_bKGD_SUPPORTED
|
||||
#define PNG_READ_cHRM_SUPPORTED
|
||||
#define PNG_READ_eXIf_SUPPORTED
|
||||
#define PNG_READ_gAMA_SUPPORTED
|
||||
#define PNG_READ_hIST_SUPPORTED
|
||||
#define PNG_READ_iCCP_SUPPORTED
|
||||
@ -153,6 +154,7 @@
|
||||
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
#define PNG_WRITE_bKGD_SUPPORTED
|
||||
#define PNG_WRITE_cHRM_SUPPORTED
|
||||
#define PNG_WRITE_eXIf_SUPPORTED
|
||||
#define PNG_WRITE_gAMA_SUPPORTED
|
||||
#define PNG_WRITE_hIST_SUPPORTED
|
||||
#define PNG_WRITE_iCCP_SUPPORTED
|
||||
@ -170,6 +172,7 @@
|
||||
#define PNG_WRITE_zTXt_SUPPORTED
|
||||
#define PNG_bKGD_SUPPORTED
|
||||
#define PNG_cHRM_SUPPORTED
|
||||
#define PNG_eXIf_SUPPORTED
|
||||
#define PNG_gAMA_SUPPORTED
|
||||
#define PNG_hIST_SUPPORTED
|
||||
#define PNG_iCCP_SUPPORTED
|
||||
|
@ -1,4 +1,4 @@
|
||||
;Version 1.6.30
|
||||
;Version 1.6.31
|
||||
;--------------------------------------------------------------
|
||||
; LIBPNG symbol list as a Win32 DEF file
|
||||
; Contains all the symbols that can be exported from libpng
|
||||
@ -250,3 +250,5 @@ EXPORTS
|
||||
png_get_palette_max @243
|
||||
png_set_option @244
|
||||
png_image_write_to_memory @245
|
||||
png_get_eXIf @246
|
||||
png_set_eXIf @247
|
||||
|
Loading…
Reference in New Issue
Block a user