mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1377118 - Update in-tree libpng to version 1.6.31. r=jrmuizel
--HG-- extra : rebase_source : 72613717bc7380d217f64ea6ae1191563bdedf4a
This commit is contained in:
parent
55f153be76
commit
8e5226d344
@ -5761,7 +5761,9 @@ Version 1.6.27beta01 [November 2, 2016]
|
||||
if built with zlib-1.2.8.1.
|
||||
|
||||
Version 1.6.27rc01 [December 27, 2016]
|
||||
Control ADLER32 checking with new PNG_IGNORE_ADLER32 option.
|
||||
Control ADLER32 checking with new PNG_IGNORE_ADLER32 option. Fixes
|
||||
an endless loop when handling erroneous ADLER32 checksums; bug
|
||||
introduced in libpng-1.6.26.
|
||||
Removed the use of a macro containing the pre-processor 'defined'
|
||||
operator. It is unclear whether this is valid; a macro that
|
||||
"generates" 'defined' is not permitted, but the use of the word
|
||||
@ -5811,12 +5813,101 @@ Version 1.6.29beta02 [February 22, 2017]
|
||||
Version 1.6.29beta03 [March 1, 2017]
|
||||
Avoid potential overflow of shift operations in png_do_expand() (Aaron Boxer).
|
||||
Change test ZLIB_VERNUM >= 0x1281 to ZLIB_VERNUM >= 0x1290 in pngrutil.c
|
||||
because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1.
|
||||
because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1,
|
||||
as suggested in zlib FAQ, item 24.
|
||||
Suppress clang warnings about implicit sign changes in png.c
|
||||
|
||||
Version 1.6.29 [March 16, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.30beta01 [April 1, 2017]
|
||||
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).
|
||||
|
||||
Version 1.6.30beta02 [April 22, 2017]
|
||||
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.
|
||||
|
||||
Version 1.6.30beta03 [May 22, 2017]
|
||||
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.
|
||||
|
||||
Version 1.6.30beta04 [June 7, 2017]
|
||||
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.
|
||||
|
||||
Version 1.6.30rc01 [June 14, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.30rc02 [June 25, 2017]
|
||||
Update copyright year in pnglibconf.h, make ltmain.sh executable.
|
||||
Add a reference to the libpng.download site in README.
|
||||
|
||||
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
|
||||
|
@ -20,7 +20,7 @@ surrounding them in the modified libpng source files.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 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
|
||||
@ -140,4 +140,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
March 16, 2017
|
||||
April 1, 2017
|
||||
|
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.6.29 - March 16, 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.
|
||||
@ -23,7 +23,7 @@ earlier versions if you are using a shared library. The type of the
|
||||
png_uint_32, which will affect shared-library applications that use
|
||||
this function.
|
||||
|
||||
To avoid problems with changes to the internals of png info_struct,
|
||||
To avoid problems with changes to the internals of the png info_struct,
|
||||
new APIs have been made available in 0.95 to avoid direct application
|
||||
access to info_ptr. These functions are the png_set_<chunk> and
|
||||
png_get_<chunk> functions. These functions should be used when
|
||||
@ -88,11 +88,11 @@ zlib should be available at the same place that libpng is, or at zlib.net.
|
||||
|
||||
You may also want a copy of the PNG specification. It is available
|
||||
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||
these at http://www.libpng.org/pub/png/documents/
|
||||
these at http://www.libpng.org/pub/png/pngdocs.html .
|
||||
|
||||
This code is currently being archived at libpng.sf.net in the
|
||||
[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it
|
||||
in any of those places, e-mail me, and I'll help you find it.
|
||||
This code is currently being archived at libpng.sourceforge.io in the
|
||||
[DOWNLOAD] area, and at http://libpng.download/src . If you
|
||||
can't find it in any of those places, e-mail me, and I'll help you find it.
|
||||
|
||||
I am not a lawyer, but I believe that the Export Control Classification
|
||||
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||
|
@ -14,7 +14,7 @@ Index: LICENSE
|
||||
+
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 2017 are
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are
|
||||
Index: pngread.c
|
||||
===================================================================
|
||||
--- pngread.c
|
||||
@ -124,7 +124,7 @@ Index: pngget.c
|
||||
===================================================================
|
||||
--- pngget.c
|
||||
+++ pngget.c
|
||||
@@ -1216,4 +1216,166 @@
|
||||
@@ -1234,4 +1234,166 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -295,12 +295,12 @@ Index: png.c
|
||||
===================================================================
|
||||
--- png.c
|
||||
+++ png.c
|
||||
@@ -776,17 +776,21 @@
|
||||
@@ -806,17 +806,21 @@
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
- "libpng version 1.6.29 - March 16, 2017" PNG_STRING_NEWLINE \
|
||||
+ "libpng version 1.6.29+apng - March 16, 2017" PNG_STRING_NEWLINE \
|
||||
- "libpng version 1.6.31 - July 27, 2017" PNG_STRING_NEWLINE \
|
||||
+ "libpng version 1.6.31+apng - 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 \
|
||||
@ -310,8 +310,8 @@ Index: png.c
|
||||
+ "Portions Copyright (c) 2006-2007 Andrew Smith" PNG_STRING_NEWLINE \
|
||||
+ "Portions Copyright (c) 2008-2017 Max Stepin" PNG_STRING_NEWLINE ;
|
||||
# else
|
||||
- return "libpng version 1.6.29 - March 16, 2017\
|
||||
+ return "libpng version 1.6.29+apng - March 16, 2017\
|
||||
- return "libpng version 1.6.31 - July 27, 2017\
|
||||
+ return "libpng version 1.6.31+apng - 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.";
|
||||
@ -337,16 +337,16 @@ Index: png.h
|
||||
+ *
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 2017 are
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are
|
||||
@@ -309,8 +315,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
-#define PNG_LIBPNG_VER_STRING "1.6.29"
|
||||
-#define PNG_HEADER_VERSION_STRING " libpng version 1.6.29 - March 16, 2017\n"
|
||||
+#define PNG_LIBPNG_VER_STRING "1.6.29+apng"
|
||||
-#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_STRING "1.6.31+apng"
|
||||
+#define PNG_HEADER_VERSION_STRING \
|
||||
+ " libpng version 1.6.29+apng - March 16, 2017\n"
|
||||
+ " libpng version 1.6.31+apng - July 27, 2017\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -379,18 +379,18 @@ Index: png.h
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
@@ -776,6 +798,10 @@
|
||||
#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
|
||||
@@ -777,6 +799,10 @@
|
||||
#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 */
|
||||
+#ifdef PNG_APNG_SUPPORTED
|
||||
+#define PNG_INFO_acTL 0x10000U
|
||||
+#define PNG_INFO_fcTL 0x20000U
|
||||
+#define PNG_INFO_acTL 0x20000U
|
||||
+#define PNG_INFO_fcTL 0x40000U
|
||||
+#endif
|
||||
|
||||
/* This is used for the transformation routines, as some of them
|
||||
* change these values for the row. It also should enable using
|
||||
@@ -813,6 +839,10 @@
|
||||
@@ -814,6 +840,10 @@
|
||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
|
||||
typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
|
||||
@ -401,75 +401,75 @@ Index: png.h
|
||||
|
||||
/* The following callback receives png_uint_32 row_number, int pass for the
|
||||
* png_bytep data of the row. When transforming an interlaced image the
|
||||
@@ -3245,6 +3275,75 @@
|
||||
@@ -3251,6 +3281,75 @@
|
||||
* END OF HARDWARE AND SOFTWARE OPTIONS
|
||||
******************************************************************************/
|
||||
|
||||
+#ifdef PNG_APNG_SUPPORTED
|
||||
+PNG_EXPORT(246, png_uint_32, png_get_acTL, (png_structp png_ptr,
|
||||
+PNG_EXPORT(248, png_uint_32, png_get_acTL, (png_structp png_ptr,
|
||||
+ png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
|
||||
+
|
||||
+PNG_EXPORT(247, png_uint_32, png_set_acTL, (png_structp png_ptr,
|
||||
+PNG_EXPORT(249, png_uint_32, png_set_acTL, (png_structp png_ptr,
|
||||
+ png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
|
||||
+
|
||||
+PNG_EXPORT(248, png_uint_32, png_get_num_frames, (png_structp png_ptr,
|
||||
+PNG_EXPORT(250, png_uint_32, png_get_num_frames, (png_structp png_ptr,
|
||||
+ png_infop info_ptr));
|
||||
+
|
||||
+PNG_EXPORT(249, png_uint_32, png_get_num_plays, (png_structp png_ptr,
|
||||
+PNG_EXPORT(251, png_uint_32, png_get_num_plays, (png_structp png_ptr,
|
||||
+ png_infop info_ptr));
|
||||
+
|
||||
+PNG_EXPORT(250, png_uint_32, png_get_next_frame_fcTL,
|
||||
+PNG_EXPORT(252, png_uint_32, png_get_next_frame_fcTL,
|
||||
+ (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
|
||||
+ png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
|
||||
+ png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
|
||||
+ png_byte *blend_op));
|
||||
+
|
||||
+PNG_EXPORT(251, png_uint_32, png_set_next_frame_fcTL,
|
||||
+PNG_EXPORT(253, png_uint_32, png_set_next_frame_fcTL,
|
||||
+ (png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
|
||||
+ png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
|
||||
+ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
|
||||
+ png_byte blend_op));
|
||||
+
|
||||
+PNG_EXPORT(252, png_uint_32, png_get_next_frame_width,
|
||||
+PNG_EXPORT(254, png_uint_32, png_get_next_frame_width,
|
||||
+ (png_structp png_ptr, png_infop info_ptr));
|
||||
+PNG_EXPORT(253, png_uint_32, png_get_next_frame_height,
|
||||
+PNG_EXPORT(255, png_uint_32, png_get_next_frame_height,
|
||||
+ (png_structp png_ptr, png_infop info_ptr));
|
||||
+PNG_EXPORT(254, png_uint_32, png_get_next_frame_x_offset,
|
||||
+PNG_EXPORT(256, png_uint_32, png_get_next_frame_x_offset,
|
||||
+ (png_structp png_ptr, png_infop info_ptr));
|
||||
+PNG_EXPORT(255, png_uint_32, png_get_next_frame_y_offset,
|
||||
+PNG_EXPORT(257, png_uint_32, png_get_next_frame_y_offset,
|
||||
+ (png_structp png_ptr, png_infop info_ptr));
|
||||
+PNG_EXPORT(256, png_uint_16, png_get_next_frame_delay_num,
|
||||
+PNG_EXPORT(258, png_uint_16, png_get_next_frame_delay_num,
|
||||
+ (png_structp png_ptr, png_infop info_ptr));
|
||||
+PNG_EXPORT(257, png_uint_16, png_get_next_frame_delay_den,
|
||||
+PNG_EXPORT(259, png_uint_16, png_get_next_frame_delay_den,
|
||||
+ (png_structp png_ptr, png_infop info_ptr));
|
||||
+PNG_EXPORT(258, png_byte, png_get_next_frame_dispose_op,
|
||||
+PNG_EXPORT(260, png_byte, png_get_next_frame_dispose_op,
|
||||
+ (png_structp png_ptr, png_infop info_ptr));
|
||||
+PNG_EXPORT(259, png_byte, png_get_next_frame_blend_op,
|
||||
+PNG_EXPORT(261, png_byte, png_get_next_frame_blend_op,
|
||||
+ (png_structp png_ptr, png_infop info_ptr));
|
||||
+PNG_EXPORT(260, png_byte, png_get_first_frame_is_hidden,
|
||||
+PNG_EXPORT(262, png_byte, png_get_first_frame_is_hidden,
|
||||
+ (png_structp png_ptr, png_infop info_ptr));
|
||||
+PNG_EXPORT(261, png_uint_32, png_set_first_frame_is_hidden,
|
||||
+PNG_EXPORT(263, png_uint_32, png_set_first_frame_is_hidden,
|
||||
+ (png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
|
||||
+
|
||||
+#ifdef PNG_READ_APNG_SUPPORTED
|
||||
+PNG_EXPORT(262, void, png_read_frame_head, (png_structp png_ptr,
|
||||
+PNG_EXPORT(264, void, png_read_frame_head, (png_structp png_ptr,
|
||||
+ png_infop info_ptr));
|
||||
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
+PNG_EXPORT(263, void, png_set_progressive_frame_fn, (png_structp png_ptr,
|
||||
+PNG_EXPORT(265, void, png_set_progressive_frame_fn, (png_structp png_ptr,
|
||||
+ png_progressive_frame_ptr frame_info_fn,
|
||||
+ png_progressive_frame_ptr frame_end_fn));
|
||||
+#endif /* PROGRESSIVE_READ */
|
||||
+#endif /* READ_APNG */
|
||||
+
|
||||
+#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
+PNG_EXPORT(264, void, png_write_frame_head, (png_structp png_ptr,
|
||||
+PNG_EXPORT(266, void, png_write_frame_head, (png_structp png_ptr,
|
||||
+ png_infop info_ptr, png_bytepp row_pointers,
|
||||
+ png_uint_32 width, png_uint_32 height,
|
||||
+ png_uint_32 x_offset, png_uint_32 y_offset,
|
||||
+ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
|
||||
+ png_byte blend_op));
|
||||
+
|
||||
+PNG_EXPORT(265, void, png_write_frame_tail, (png_structp png_ptr,
|
||||
+PNG_EXPORT(267, void, png_write_frame_tail, (png_structp png_ptr,
|
||||
+ png_infop info_ptr));
|
||||
+#endif /* WRITE_APNG */
|
||||
+#endif /* APNG */
|
||||
@ -477,14 +477,14 @@ Index: png.h
|
||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
|
||||
* defs, and in scripts/symbols.def.
|
||||
*/
|
||||
@@ -3253,7 +3352,11 @@
|
||||
@@ -3259,7 +3358,11 @@
|
||||
* one to use is one more than this.)
|
||||
*/
|
||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||
+#ifdef PNG_APNG_SUPPORTED
|
||||
+ PNG_EXPORT_LAST_ORDINAL(265);
|
||||
+ PNG_EXPORT_LAST_ORDINAL(267);
|
||||
+#else
|
||||
PNG_EXPORT_LAST_ORDINAL(245);
|
||||
PNG_EXPORT_LAST_ORDINAL(247);
|
||||
+#endif /* APNG */
|
||||
#endif
|
||||
|
||||
@ -493,7 +493,7 @@ Index: pngpriv.h
|
||||
===================================================================
|
||||
--- pngpriv.h
|
||||
+++ pngpriv.h
|
||||
@@ -616,6 +616,10 @@
|
||||
@@ -628,6 +628,10 @@
|
||||
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
|
||||
/* 0x4000U (unused) */
|
||||
#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
|
||||
@ -504,7 +504,7 @@ Index: pngpriv.h
|
||||
|
||||
/* Flags for the transformations the PNG library does on the image data */
|
||||
#define PNG_BGR 0x0001U
|
||||
@@ -851,6 +855,16 @@
|
||||
@@ -864,6 +868,16 @@
|
||||
#define png_tRNS PNG_U32(116, 82, 78, 83)
|
||||
#define png_zTXt PNG_U32(122, 84, 88, 116)
|
||||
|
||||
@ -521,7 +521,7 @@ Index: pngpriv.h
|
||||
/* The following will work on (signed char*) strings, whereas the get_uint_32
|
||||
* macro will fail on top-bit-set values because of the sign extension.
|
||||
*/
|
||||
@@ -1589,6 +1603,49 @@
|
||||
@@ -1607,6 +1621,49 @@
|
||||
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
|
||||
@ -575,7 +575,7 @@ Index: pnginfo.h
|
||||
===================================================================
|
||||
--- pnginfo.h
|
||||
+++ pnginfo.h
|
||||
@@ -255,5 +255,18 @@
|
||||
@@ -260,5 +260,18 @@
|
||||
png_bytepp row_pointers; /* the image bits */
|
||||
#endif
|
||||
|
||||
@ -934,7 +934,7 @@ Index: pngset.c
|
||||
===================================================================
|
||||
--- pngset.c
|
||||
+++ pngset.c
|
||||
@@ -241,6 +241,11 @@
|
||||
@@ -274,6 +274,11 @@
|
||||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
||||
|
||||
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
|
||||
@ -946,7 +946,7 @@ Index: pngset.c
|
||||
}
|
||||
|
||||
#ifdef PNG_oFFs_SUPPORTED
|
||||
@@ -1110,6 +1115,146 @@
|
||||
@@ -1144,6 +1149,146 @@
|
||||
}
|
||||
#endif /* sPLT */
|
||||
|
||||
@ -1109,7 +1109,7 @@ Index: pngrutil.c
|
||||
/* Set internal variables */
|
||||
png_ptr->width = width;
|
||||
png_ptr->height = height;
|
||||
@@ -2761,6 +2766,180 @@
|
||||
@@ -2802,6 +2807,180 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1290,7 +1290,7 @@ Index: pngrutil.c
|
||||
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
/* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
|
||||
static int
|
||||
@@ -4023,6 +4202,38 @@
|
||||
@@ -4070,6 +4249,38 @@
|
||||
uInt avail_in;
|
||||
png_bytep buffer;
|
||||
|
||||
@ -1329,7 +1329,7 @@ Index: pngrutil.c
|
||||
while (png_ptr->idat_size == 0)
|
||||
{
|
||||
png_crc_finish(png_ptr, 0);
|
||||
@@ -4034,6 +4245,7 @@
|
||||
@@ -4081,6 +4292,7 @@
|
||||
if (png_ptr->chunk_name != png_IDAT)
|
||||
png_error(png_ptr, "Not enough image data");
|
||||
}
|
||||
@ -1337,7 +1337,7 @@ Index: pngrutil.c
|
||||
|
||||
avail_in = png_ptr->IDAT_read_size;
|
||||
|
||||
@@ -4097,6 +4309,9 @@
|
||||
@@ -4144,6 +4356,9 @@
|
||||
|
||||
png_ptr->mode |= PNG_AFTER_IDAT;
|
||||
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
|
||||
@ -1347,7 +1347,7 @@ Index: pngrutil.c
|
||||
|
||||
if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
|
||||
png_chunk_benign_error(png_ptr, "Extra compressed data");
|
||||
@@ -4535,4 +4750,80 @@
|
||||
@@ -4582,4 +4797,80 @@
|
||||
|
||||
png_ptr->flags |= PNG_FLAG_ROW_INIT;
|
||||
}
|
||||
@ -1444,39 +1444,43 @@ Index: pngwutil.c
|
||||
if ((png_ptr->do_filter) == PNG_NO_FILTERS)
|
||||
{
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
|
||||
@@ -1003,7 +1008,15 @@
|
||||
optimize_cmf(data, png_image_size(png_ptr));
|
||||
@@ -1004,7 +1009,17 @@
|
||||
#endif
|
||||
|
||||
if (size > 0)
|
||||
+#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
+ if (png_ptr->num_frames_written == 0)
|
||||
+ {
|
||||
+ if (png_ptr->num_frames_written == 0)
|
||||
+#endif
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
+#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
+ else
|
||||
+ png_write_fdAT(png_ptr, data, size);
|
||||
+ else
|
||||
+ png_write_fdAT(png_ptr, data, size);
|
||||
+ }
|
||||
+#endif /* WRITE_APNG */
|
||||
+
|
||||
png_ptr->mode |= PNG_HAVE_IDAT;
|
||||
|
||||
png_ptr->zstream.next_out = data;
|
||||
@@ -1049,7 +1062,15 @@
|
||||
optimize_cmf(data, png_image_size(png_ptr));
|
||||
@@ -1051,7 +1066,17 @@
|
||||
#endif
|
||||
|
||||
if (size > 0)
|
||||
+#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
+ if (png_ptr->num_frames_written == 0)
|
||||
+ {
|
||||
+ if (png_ptr->num_frames_written == 0)
|
||||
+#endif
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
+#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
+ else
|
||||
+ png_write_fdAT(png_ptr, data, size);
|
||||
+ else
|
||||
+ png_write_fdAT(png_ptr, data, size);
|
||||
+ }
|
||||
+#endif /* WRITE_APNG */
|
||||
+
|
||||
png_ptr->zstream.avail_out = 0;
|
||||
png_ptr->zstream.next_out = NULL;
|
||||
png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
|
||||
@@ -1863,6 +1884,82 @@
|
||||
@@ -1896,6 +1921,82 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1559,7 +1563,7 @@ Index: pngwutil.c
|
||||
/* Initializes the row writing capability of libpng */
|
||||
void /* PRIVATE */
|
||||
png_write_start_row(png_structrp png_ptr)
|
||||
@@ -2757,4 +2854,39 @@
|
||||
@@ -2790,4 +2891,39 @@
|
||||
}
|
||||
#endif /* WRITE_FLUSH */
|
||||
}
|
||||
@ -1603,27 +1607,27 @@ Index: scripts/symbols.def
|
||||
===================================================================
|
||||
--- scripts/symbols.def
|
||||
+++ scripts/symbols.def
|
||||
@@ -250,3 +250,23 @@
|
||||
png_get_palette_max @243
|
||||
png_set_option @244
|
||||
@@ -252,3 +252,23 @@
|
||||
png_image_write_to_memory @245
|
||||
+ png_get_acTL @246
|
||||
+ png_set_acTL @247
|
||||
+ png_get_num_frames @248
|
||||
+ png_get_num_plays @249
|
||||
+ png_get_next_frame_fcTL @250
|
||||
+ png_set_next_frame_fcTL @251
|
||||
+ png_get_next_frame_width @252
|
||||
+ png_get_next_frame_height @253
|
||||
+ png_get_next_frame_x_offset @254
|
||||
+ png_get_next_frame_y_offset @255
|
||||
+ png_get_next_frame_delay_num @256
|
||||
+ png_get_next_frame_delay_den @257
|
||||
+ png_get_next_frame_dispose_op @258
|
||||
+ png_get_next_frame_blend_op @259
|
||||
+ png_get_first_frame_is_hidden @260
|
||||
+ png_set_first_frame_is_hidden @261
|
||||
+ png_read_frame_head @262
|
||||
+ png_set_progressive_frame_fn @263
|
||||
+ png_write_frame_head @264
|
||||
+ png_write_frame_tail @265
|
||||
png_get_eXIf @246
|
||||
png_set_eXIf @247
|
||||
+ png_get_acTL @248
|
||||
+ png_set_acTL @249
|
||||
+ png_get_num_frames @250
|
||||
+ png_get_num_plays @251
|
||||
+ png_get_next_frame_fcTL @252
|
||||
+ png_set_next_frame_fcTL @253
|
||||
+ png_get_next_frame_width @254
|
||||
+ png_get_next_frame_height @255
|
||||
+ png_get_next_frame_x_offset @256
|
||||
+ png_get_next_frame_y_offset @257
|
||||
+ png_get_next_frame_delay_num @258
|
||||
+ png_get_next_frame_delay_den @259
|
||||
+ png_get_next_frame_dispose_op @260
|
||||
+ png_get_next_frame_blend_op @261
|
||||
+ png_get_first_frame_is_hidden @262
|
||||
+ png_set_first_frame_is_hidden @263
|
||||
+ png_read_frame_head @264
|
||||
+ png_set_progressive_frame_fn @265
|
||||
+ png_write_frame_head @266
|
||||
+ png_write_frame_tail @267
|
||||
|
@ -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
|
||||
@ -22,7 +22,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
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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,9 +1,9 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.29 - March 16, 2017
|
||||
libpng version 1.6.31 - July 27, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
|
||||
This document is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.29 - March 16, 2017
|
||||
libpng versions 0.97, January 1998, through 1.6.31 - July 27, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
|
||||
libpng 1.0 beta 6 - version 0.96 - May 28, 1997
|
||||
Updated and distributed by Andreas Dilger
|
||||
@ -66,17 +66,17 @@ file format in application programs.
|
||||
|
||||
The PNG specification (second edition), November 2003, is available as
|
||||
a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at
|
||||
<http://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
<https://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
The W3C and ISO documents have identical technical content.
|
||||
|
||||
The PNG-1.2 specification is available at
|
||||
<http://png-mng.sourceforge.net/pub/png/spec/1.2/>.
|
||||
<https://png-mng.sourceforge.io/pub/png/spec/1.2/>.
|
||||
It is technically equivalent
|
||||
to the PNG specification (second edition) but has some additional material.
|
||||
|
||||
The PNG-1.0 specification is available as RFC 2083
|
||||
<http://png-mng.sourceforge.net/pub/png/spec/1.0/> and as a
|
||||
W3C Recommendation <http://www.w3.org/TR/REC-png-961001>.
|
||||
The PNG-1.0 specification is available as RFC 2083
|
||||
<https://png-mng.sourceforge.io/pub/png/spec/1.0/> and as a
|
||||
W3C Recommendation <https://www.w3.org/TR/REC-png-961001>.
|
||||
|
||||
Some additional chunks are described in the special-purpose public chunks
|
||||
documents at <http://www.libpng.org/pub/png/spec/register/>
|
||||
@ -101,7 +101,7 @@ majority of the needs of its users.
|
||||
|
||||
Libpng uses zlib for its compression and decompression of PNG files.
|
||||
Further information about zlib, and the latest version of zlib, can
|
||||
be found at the zlib home page, <http://zlib.net/>.
|
||||
be found at the zlib home page, <https://zlib.net/>.
|
||||
The zlib compression utility is a general purpose utility that is
|
||||
useful for more than PNG files, and can be used without libpng.
|
||||
See the documentation delivered with zlib for more details.
|
||||
@ -1190,7 +1190,20 @@ row_pointers prior to calling png_read_png() with
|
||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||
|
||||
Alternatively you could allocate your image in one big block and define
|
||||
row_pointers[i] to point into the proper places in your block.
|
||||
row_pointers[i] to point into the proper places in your block, but first
|
||||
be sure that your platform is able to allocate such a large buffer:
|
||||
|
||||
/* Guard against integer overflow */
|
||||
if (height > PNG_SIZE_MAX/(width*pixel_size)) {
|
||||
png_error(png_ptr,"image_data buffer would be too large");
|
||||
}
|
||||
|
||||
png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size);
|
||||
|
||||
for (int i=0; i<height, i++)
|
||||
row_pointers[i]=buffer+i*width*pixel_size;
|
||||
|
||||
png_set_rows(png_ptr, info_ptr, &row_pointers);
|
||||
|
||||
If you use png_set_rows(), the application is responsible for freeing
|
||||
row_pointers (and row_pointers[i], if they were separately allocated).
|
||||
@ -1317,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);
|
||||
|
||||
@ -1435,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)
|
||||
|
||||
@ -2146,6 +2169,16 @@ are allocating one large chunk, you will need to build an
|
||||
array of pointers to each row, as it will be needed for some
|
||||
of the functions below.
|
||||
|
||||
Be sure that your platform can allocate the buffer that you'll need.
|
||||
libpng internally checks for oversize width, but you'll need to
|
||||
do your own check for number_of_rows*width*pixel_size if you are using
|
||||
a multiple-row buffer:
|
||||
|
||||
/* Guard against integer overflow */
|
||||
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) {
|
||||
png_error(png_ptr,"image_data buffer would be too large");
|
||||
}
|
||||
|
||||
Remember: Before you call png_read_update_info(), the png_get_*()
|
||||
functions return the values corresponding to the original PNG image.
|
||||
After you call png_read_update_info the values refer to the image
|
||||
@ -2470,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,
|
||||
@ -3069,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
|
||||
@ -3824,7 +3863,7 @@ PNG_FORMAT_FLAG_LINEAR flag below.
|
||||
|
||||
When the simplified API needs to convert between sRGB and linear colorspaces,
|
||||
the actual sRGB transfer curve defined in the sRGB specification (see the
|
||||
article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
|
||||
article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
|
||||
approximation used elsewhere in libpng.
|
||||
|
||||
When an alpha channel is present it is expected to denote pixel coverage
|
||||
@ -4088,7 +4127,7 @@ READ APIs
|
||||
|
||||
When the simplified API needs to convert between sRGB and linear colorspaces,
|
||||
the actual sRGB transfer curve defined in the sRGB specification (see the
|
||||
article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
|
||||
article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
|
||||
approximation used elsewhere in libpng.
|
||||
|
||||
WRITE APIS
|
||||
@ -4246,8 +4285,6 @@ functions after png_create_*_struct() has been called by calling:
|
||||
png_voidp error_ptr, png_error_ptr error_fn,
|
||||
png_error_ptr warning_fn);
|
||||
|
||||
png_voidp error_ptr = png_get_error_ptr(png_ptr);
|
||||
|
||||
If NULL is supplied for either error_fn or warning_fn, then the libpng
|
||||
default function will be used, calling fprintf() and/or longjmp() if a
|
||||
problem is encountered. The replacement error functions should have
|
||||
@ -4259,6 +4296,11 @@ parameters as follows:
|
||||
void user_warning_fn(png_structp png_ptr,
|
||||
png_const_charp warning_msg);
|
||||
|
||||
Then, within your user_error_fn or user_warning_fn, you can retrieve
|
||||
the error_ptr if you need it, by calling
|
||||
|
||||
png_voidp error_ptr = png_get_error_ptr(png_ptr);
|
||||
|
||||
The motivation behind using setjmp() and longjmp() is the C++ throw and
|
||||
catch exception handling methods. This makes the code much easier to write,
|
||||
as there is no need to check every return code of every function call.
|
||||
@ -4266,7 +4308,7 @@ However, there are some uncertainties about the status of local variables
|
||||
after a longjmp, so the user may want to be careful about doing anything
|
||||
after setjmp returns non-zero besides returning itself. Consult your
|
||||
compiler documentation for more details. For an alternative approach, you
|
||||
may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net),
|
||||
may wish to use the "cexcept" facility (see https://cexcept.sourceforge.io/),
|
||||
which is illustrated in pngvalid.c and in contrib/visupng.
|
||||
|
||||
Beginning in libpng-1.4.0, the png_set_benign_errors() API became available.
|
||||
@ -4494,7 +4536,7 @@ in a MNG datastream. As a minimum, it must have the MNG 8-byte signature
|
||||
and the MHDR and MEND chunks. Libpng does not provide support for these
|
||||
or any other MNG chunks; your application must provide its own support for
|
||||
them. You may wish to consider using libmng (available at
|
||||
http://www.libmng.com) instead.
|
||||
https://www.libmng.com/) instead.
|
||||
|
||||
VIII. Changes to Libpng from version 0.88
|
||||
|
||||
@ -4917,18 +4959,14 @@ PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said
|
||||
that it could be used to override them. Now this function will reduce or
|
||||
increase the limits.
|
||||
|
||||
Starting in libpng-1.5.10, the user limits can be set en masse with the
|
||||
configuration option PNG_SAFE_LIMITS_SUPPORTED. If this option is enabled,
|
||||
a set of "safe" limits is applied in pngpriv.h. These can be overridden by
|
||||
application calls to png_set_user_limits(), png_set_user_chunk_cache_max(),
|
||||
and/or png_set_user_malloc_max() that increase or decrease the limits. Also,
|
||||
in libpng-1.5.10 the default width and height limits were increased
|
||||
from 1,000,000 to 0x7fffffff (i.e., made unlimited). Therefore, the
|
||||
limits are now
|
||||
default safe
|
||||
Starting in libpng-1.5.22, default user limits were established. These
|
||||
can be overridden by application calls to png_set_user_limits(),
|
||||
png_set_user_chunk_cache_max(), and/or png_set_user_malloc_max().
|
||||
The limits are now
|
||||
max possible default
|
||||
png_user_width_max 0x7fffffff 1,000,000
|
||||
png_user_height_max 0x7fffffff 1,000,000
|
||||
png_user_chunk_cache_max 0 (unlimited) 128
|
||||
png_user_chunk_cache_max 0 (unlimited) 1000
|
||||
png_user_chunk_malloc_max 0 (unlimited) 8,000,000
|
||||
|
||||
The png_set_option() function (and the "options" member of the png struct) was
|
||||
@ -5178,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
|
||||
@ -5194,27 +5237,33 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files
|
||||
going back to version 0.70. You can access the git repository (read only)
|
||||
at
|
||||
|
||||
git://git.code.sf.net/p/libpng/code
|
||||
https://github.com/glennrp/libpng or
|
||||
https://git.code.sf.net/p/libpng/code.git
|
||||
|
||||
or you can browse it with a web browser by selecting the "code" button at
|
||||
or you can browse it with a web browser at
|
||||
|
||||
https://sourceforge.net/projects/libpng
|
||||
https://github.com/glennrp/libpng or
|
||||
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
|
||||
|
||||
Patches can be sent to glennrp at users.sourceforge.net or to
|
||||
png-mng-implement at lists.sourceforge.net or you can upload them to
|
||||
the libpng bug tracker at
|
||||
|
||||
http://libpng.sourceforge.net
|
||||
https://libpng.sourceforge.io/
|
||||
|
||||
or as a "pull request" to
|
||||
|
||||
https://github.com/glennrp/libpng/pulls
|
||||
|
||||
We also accept patches built from the tar or zip distributions, and
|
||||
simple verbal discriptions of bug fixes, reported either to the
|
||||
SourceForge bug tracker, to the png-mng-implement at lists.sf.net
|
||||
mailing list, or directly to glennrp.
|
||||
mailing list, as github issues, or directly to glennrp.
|
||||
|
||||
XV. Coding style
|
||||
|
||||
Our coding style is similar to the "Allman" style
|
||||
(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
|
||||
(See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
|
||||
braces on separate lines:
|
||||
|
||||
if (condition)
|
||||
@ -5315,7 +5364,7 @@ Prior to libpng-1.6.0 we used a "png_sizeof()" macro, formatted as
|
||||
though it were a function.
|
||||
|
||||
Control keywords if, for, while, and switch are always followed by a space
|
||||
to distinguish them from function calls, which have no trailing space.
|
||||
to distinguish them from function calls, which have no trailing space.
|
||||
|
||||
We put a space after each comma and after each semicolon
|
||||
in "for" statements, and we put spaces before and after each
|
||||
@ -5341,7 +5390,7 @@ for a few type names that we inherit from zlib.h.
|
||||
|
||||
We prefer "if (something != 0)" and "if (something == 0)" over
|
||||
"if (something)" and if "(!something)", respectively, and for pointers
|
||||
we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
|
||||
we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
|
||||
|
||||
We do not use the TAB character for indentation in the C sources.
|
||||
|
||||
@ -5355,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.29 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
* 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_29 Your_png_h_is_not_version_1_6_29;
|
||||
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,7 +806,7 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.29+apng - March 16, 2017" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.31+apng - 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 \
|
||||
@ -785,7 +815,7 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
"Portions Copyright (c) 2006-2007 Andrew Smith" PNG_STRING_NEWLINE \
|
||||
"Portions Copyright (c) 2008-2017 Max Stepin" PNG_STRING_NEWLINE ;
|
||||
# else
|
||||
return "libpng version 1.6.29+apng - March 16, 2017\
|
||||
return "libpng version 1.6.31+apng - 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.\
|
||||
@ -2836,7 +2866,7 @@ png_pow10(int power)
|
||||
if (power < 0)
|
||||
{
|
||||
if (power < DBL_MIN_10_EXP) return 0;
|
||||
recip = 1, power = -power;
|
||||
recip = 1; power = -power;
|
||||
}
|
||||
|
||||
if (power > 0)
|
||||
@ -2861,6 +2891,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)
|
||||
@ -2914,7 +2952,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
double test = png_pow10(exp_b10+1);
|
||||
|
||||
if (test <= DBL_MAX)
|
||||
++exp_b10, base = test;
|
||||
{
|
||||
++exp_b10; base = test;
|
||||
}
|
||||
|
||||
else
|
||||
break;
|
||||
@ -2928,7 +2968,10 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
* test on DBL_MAX above.
|
||||
*/
|
||||
fp /= base;
|
||||
while (fp >= 1) fp /= 10, ++exp_b10;
|
||||
while (fp >= 1)
|
||||
{
|
||||
fp /= 10; ++exp_b10;
|
||||
}
|
||||
|
||||
/* Because of the code above fp may, at this point, be
|
||||
* less than .1, this is ok because the code below can
|
||||
@ -2945,7 +2988,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
|
||||
@ -2979,7 +3022,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
/* Rounding up to 10, handle that here. */
|
||||
if (czero > 0)
|
||||
{
|
||||
--czero, d = 1;
|
||||
--czero; d = 1;
|
||||
if (cdigits == 0) --clead;
|
||||
}
|
||||
else
|
||||
@ -2993,7 +3036,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
|
||||
else if (ch == 46)
|
||||
{
|
||||
ch = *--ascii, ++size;
|
||||
ch = *--ascii; ++size;
|
||||
/* Advance exp_b10 to '1', so that the
|
||||
* decimal point happens after the
|
||||
* previous digit.
|
||||
@ -3020,7 +3063,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
int ch = *--ascii;
|
||||
|
||||
if (ch == 46)
|
||||
++size, exp_b10 = 1;
|
||||
{
|
||||
++size; exp_b10 = 1;
|
||||
}
|
||||
|
||||
/* Else lost a leading zero, so 'exp_b10' is
|
||||
* still ok at (-1)
|
||||
@ -3056,21 +3101,26 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
*/
|
||||
if (exp_b10 != (-1))
|
||||
{
|
||||
if (exp_b10 == 0) *ascii++ = 46, --size;
|
||||
if (exp_b10 == 0)
|
||||
{
|
||||
*ascii++ = 46; --size;
|
||||
}
|
||||
/* PLUS 1: TOTAL 4 */
|
||||
--exp_b10;
|
||||
}
|
||||
*ascii++ = 48, --czero;
|
||||
*ascii++ = 48; --czero;
|
||||
}
|
||||
|
||||
if (exp_b10 != (-1))
|
||||
{
|
||||
if (exp_b10 == 0)
|
||||
*ascii++ = 46, --size; /* counted above */
|
||||
{
|
||||
*ascii++ = 46; --size; /* counted above */
|
||||
}
|
||||
|
||||
--exp_b10;
|
||||
}
|
||||
*ascii++ = (char)(48 + (int)d), ++cdigits;
|
||||
*ascii++ = (char)(48 + (int)d); ++cdigits;
|
||||
}
|
||||
}
|
||||
while (cdigits+czero < precision+clead && fp > DBL_MIN);
|
||||
@ -3079,7 +3129,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!)
|
||||
@ -3093,7 +3143,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;
|
||||
|
||||
@ -3111,7 +3161,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
*/
|
||||
size -= cdigits;
|
||||
|
||||
*ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */
|
||||
*ascii++ = 69; --size; /* 'E': PLUS 1 TOTAL 2+precision */
|
||||
|
||||
/* The following use of an unsigned temporary avoids ambiguities in
|
||||
* the signed arithmetic on exp_b10 and permits GCC at least to do
|
||||
@ -3122,12 +3172,12 @@ 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);
|
||||
*ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */
|
||||
uexp_b10 = 0U-exp_b10;
|
||||
}
|
||||
|
||||
else
|
||||
uexp_b10 = (unsigned int)exp_b10;
|
||||
uexp_b10 = 0U+exp_b10;
|
||||
|
||||
cdigits = 0;
|
||||
|
||||
@ -3170,6 +3220,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 */
|
||||
|
||||
@ -3189,7 +3242,9 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
||||
|
||||
/* Avoid overflow here on the minimum integer. */
|
||||
if (fp < 0)
|
||||
*ascii++ = 45, num = (png_uint_32)(-fp);
|
||||
{
|
||||
*ascii++ = 45; num = (png_uint_32)(-fp);
|
||||
}
|
||||
else
|
||||
num = (png_uint_32)fp;
|
||||
|
||||
@ -3227,7 +3282,10 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
||||
* then ndigits digits to first:
|
||||
*/
|
||||
i = 5;
|
||||
while (ndigits < i) *ascii++ = 48, --i;
|
||||
while (ndigits < i)
|
||||
{
|
||||
*ascii++ = 48; --i;
|
||||
}
|
||||
while (ndigits >= first) *ascii++ = digits[--ndigits];
|
||||
/* Don't output the trailing zeros! */
|
||||
}
|
||||
@ -3278,6 +3336,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)
|
||||
@ -3392,6 +3459,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)
|
||||
@ -4282,7 +4352,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
|
||||
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||
/* sRGB conversion tables; these are machine generated with the code in
|
||||
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
|
||||
* specification (see the article at http://en.wikipedia.org/wiki/SRGB)
|
||||
* specification (see the article at https://en.wikipedia.org/wiki/SRGB)
|
||||
* is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
|
||||
* The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
|
||||
* The inverse (linear to sRGB) table has accuracies as follows:
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.29, March 16, 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.29, March 16, 2017:
|
||||
* libpng versions 0.97, January 1998, through 1.6.31, July 27, 2017:
|
||||
* Glenn Randers-Pehrson.
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
@ -31,7 +31,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 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
|
||||
@ -219,7 +219,7 @@
|
||||
* ...
|
||||
* 1.5.28 15 10527 15.so.15.28[.0]
|
||||
* ...
|
||||
* 1.6.29 16 10629 16.so.16.29[.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
|
||||
@ -240,20 +240,20 @@
|
||||
*
|
||||
* See libpng.txt or libpng.3 for more information. The PNG specification
|
||||
* is available as a W3C Recommendation and as an ISO Specification,
|
||||
* <http://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
* <https://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* March 16, 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.29 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
|
||||
@ -315,9 +315,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.29+apng"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.31+apng"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.29+apng - March 16, 2017\n"
|
||||
" libpng version 1.6.31+apng - July 27, 2017\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -325,7 +325,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 29
|
||||
#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:
|
||||
@ -356,7 +356,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 10629 /* 1.6.29 */
|
||||
#define PNG_LIBPNG_VER 10631 /* 1.6.31 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@ -481,7 +481,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_29;
|
||||
typedef char* png_libpng_version_1_6_31;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
@ -798,9 +798,10 @@ 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 */
|
||||
#ifdef PNG_APNG_SUPPORTED
|
||||
#define PNG_INFO_acTL 0x10000U
|
||||
#define PNG_INFO_fcTL 0x20000U
|
||||
#define PNG_INFO_acTL 0x20000U
|
||||
#define PNG_INFO_fcTL 0x40000U
|
||||
#endif
|
||||
|
||||
/* This is used for the transformation routines, as some of them
|
||||
@ -1818,7 +1819,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
|
||||
@ -2037,6 +2039,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))
|
||||
@ -2055,9 +2064,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
|
||||
@ -2783,7 +2789,7 @@ typedef struct
|
||||
*
|
||||
* When the simplified API needs to convert between sRGB and linear colorspaces,
|
||||
* the actual sRGB transfer curve defined in the sRGB specification (see the
|
||||
* article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
|
||||
* article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
|
||||
* approximation used elsewhere in libpng.
|
||||
*
|
||||
* When an alpha channel is present it is expected to denote pixel coverage
|
||||
@ -3276,70 +3282,70 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef PNG_APNG_SUPPORTED
|
||||
PNG_EXPORT(246, png_uint_32, png_get_acTL, (png_structp png_ptr,
|
||||
PNG_EXPORT(248, png_uint_32, png_get_acTL, (png_structp png_ptr,
|
||||
png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
|
||||
|
||||
PNG_EXPORT(247, png_uint_32, png_set_acTL, (png_structp png_ptr,
|
||||
PNG_EXPORT(249, png_uint_32, png_set_acTL, (png_structp png_ptr,
|
||||
png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
|
||||
|
||||
PNG_EXPORT(248, png_uint_32, png_get_num_frames, (png_structp png_ptr,
|
||||
PNG_EXPORT(250, png_uint_32, png_get_num_frames, (png_structp png_ptr,
|
||||
png_infop info_ptr));
|
||||
|
||||
PNG_EXPORT(249, png_uint_32, png_get_num_plays, (png_structp png_ptr,
|
||||
PNG_EXPORT(251, png_uint_32, png_get_num_plays, (png_structp png_ptr,
|
||||
png_infop info_ptr));
|
||||
|
||||
PNG_EXPORT(250, png_uint_32, png_get_next_frame_fcTL,
|
||||
PNG_EXPORT(252, png_uint_32, png_get_next_frame_fcTL,
|
||||
(png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
|
||||
png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
|
||||
png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
|
||||
png_byte *blend_op));
|
||||
|
||||
PNG_EXPORT(251, png_uint_32, png_set_next_frame_fcTL,
|
||||
PNG_EXPORT(253, png_uint_32, png_set_next_frame_fcTL,
|
||||
(png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
|
||||
png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
|
||||
png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
|
||||
png_byte blend_op));
|
||||
|
||||
PNG_EXPORT(252, png_uint_32, png_get_next_frame_width,
|
||||
PNG_EXPORT(254, png_uint_32, png_get_next_frame_width,
|
||||
(png_structp png_ptr, png_infop info_ptr));
|
||||
PNG_EXPORT(253, png_uint_32, png_get_next_frame_height,
|
||||
PNG_EXPORT(255, png_uint_32, png_get_next_frame_height,
|
||||
(png_structp png_ptr, png_infop info_ptr));
|
||||
PNG_EXPORT(254, png_uint_32, png_get_next_frame_x_offset,
|
||||
PNG_EXPORT(256, png_uint_32, png_get_next_frame_x_offset,
|
||||
(png_structp png_ptr, png_infop info_ptr));
|
||||
PNG_EXPORT(255, png_uint_32, png_get_next_frame_y_offset,
|
||||
PNG_EXPORT(257, png_uint_32, png_get_next_frame_y_offset,
|
||||
(png_structp png_ptr, png_infop info_ptr));
|
||||
PNG_EXPORT(256, png_uint_16, png_get_next_frame_delay_num,
|
||||
PNG_EXPORT(258, png_uint_16, png_get_next_frame_delay_num,
|
||||
(png_structp png_ptr, png_infop info_ptr));
|
||||
PNG_EXPORT(257, png_uint_16, png_get_next_frame_delay_den,
|
||||
PNG_EXPORT(259, png_uint_16, png_get_next_frame_delay_den,
|
||||
(png_structp png_ptr, png_infop info_ptr));
|
||||
PNG_EXPORT(258, png_byte, png_get_next_frame_dispose_op,
|
||||
PNG_EXPORT(260, png_byte, png_get_next_frame_dispose_op,
|
||||
(png_structp png_ptr, png_infop info_ptr));
|
||||
PNG_EXPORT(259, png_byte, png_get_next_frame_blend_op,
|
||||
PNG_EXPORT(261, png_byte, png_get_next_frame_blend_op,
|
||||
(png_structp png_ptr, png_infop info_ptr));
|
||||
PNG_EXPORT(260, png_byte, png_get_first_frame_is_hidden,
|
||||
PNG_EXPORT(262, png_byte, png_get_first_frame_is_hidden,
|
||||
(png_structp png_ptr, png_infop info_ptr));
|
||||
PNG_EXPORT(261, png_uint_32, png_set_first_frame_is_hidden,
|
||||
PNG_EXPORT(263, png_uint_32, png_set_first_frame_is_hidden,
|
||||
(png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
|
||||
|
||||
#ifdef PNG_READ_APNG_SUPPORTED
|
||||
PNG_EXPORT(262, void, png_read_frame_head, (png_structp png_ptr,
|
||||
PNG_EXPORT(264, void, png_read_frame_head, (png_structp png_ptr,
|
||||
png_infop info_ptr));
|
||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
PNG_EXPORT(263, void, png_set_progressive_frame_fn, (png_structp png_ptr,
|
||||
PNG_EXPORT(265, void, png_set_progressive_frame_fn, (png_structp png_ptr,
|
||||
png_progressive_frame_ptr frame_info_fn,
|
||||
png_progressive_frame_ptr frame_end_fn));
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
#endif /* READ_APNG */
|
||||
|
||||
#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
PNG_EXPORT(264, void, png_write_frame_head, (png_structp png_ptr,
|
||||
PNG_EXPORT(266, void, png_write_frame_head, (png_structp png_ptr,
|
||||
png_infop info_ptr, png_bytepp row_pointers,
|
||||
png_uint_32 width, png_uint_32 height,
|
||||
png_uint_32 x_offset, png_uint_32 y_offset,
|
||||
png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
|
||||
png_byte blend_op));
|
||||
|
||||
PNG_EXPORT(265, void, png_write_frame_tail, (png_structp png_ptr,
|
||||
PNG_EXPORT(267, void, png_write_frame_tail, (png_structp png_ptr,
|
||||
png_infop info_ptr));
|
||||
#endif /* WRITE_APNG */
|
||||
#endif /* APNG */
|
||||
@ -3353,9 +3359,9 @@ PNG_EXPORT(265, void, png_write_frame_tail, (png_structp png_ptr,
|
||||
*/
|
||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||
#ifdef PNG_APNG_SUPPORTED
|
||||
PNG_EXPORT_LAST_ORDINAL(265);
|
||||
PNG_EXPORT_LAST_ORDINAL(267);
|
||||
#else
|
||||
PNG_EXPORT_LAST_ORDINAL(245);
|
||||
PNG_EXPORT_LAST_ORDINAL(247);
|
||||
#endif /* APNG */
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.29, March 16, 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];
|
||||
|
@ -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
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
* 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,25 +454,6 @@
|
||||
# define png_fixed_error(s1,s2) png_err(s1)
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
* const is not cast away.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
# define png_voidcast(type, value) static_cast<type>(value)
|
||||
# define png_constcast(type, value) const_cast<type>(value)
|
||||
# define png_aligncast(type, value) \
|
||||
static_cast<type>(static_cast<void*>(value))
|
||||
# define png_aligncastconst(type, value) \
|
||||
static_cast<type>(static_cast<const void*>(value))
|
||||
#else
|
||||
# define png_voidcast(type, value) (value)
|
||||
# define png_constcast(type, value) ((type)(value))
|
||||
# define png_aligncast(type, value) ((void*)(value))
|
||||
# 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:
|
||||
@ -485,6 +468,35 @@
|
||||
/* 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
|
||||
* const is not cast away.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
# define png_voidcast(type, value) static_cast<type>(value)
|
||||
# define png_constcast(type, value) const_cast<type>(value)
|
||||
# define png_aligncast(type, value) \
|
||||
static_cast<type>(static_cast<void*>(value))
|
||||
# define png_aligncastconst(type, value) \
|
||||
static_cast<type>(static_cast<const void*>(value))
|
||||
#else
|
||||
# define png_voidcast(type, value) (value)
|
||||
# ifdef _WIN64
|
||||
# ifdef __GNUC__
|
||||
typedef unsigned long long png_ptruint;
|
||||
# else
|
||||
typedef unsigned __int64 png_ptruint;
|
||||
# endif
|
||||
# else
|
||||
typedef unsigned long png_ptruint;
|
||||
# endif
|
||||
# define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value))
|
||||
# define png_aligncast(type, value) ((void*)(value))
|
||||
# define png_aligncastconst(type, value) ((const void*)(value))
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
|
||||
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
|
||||
/* png.c requires the following ANSI-C constants if the conversion of
|
||||
@ -834,6 +846,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)
|
||||
@ -1443,6 +1456,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);
|
||||
|
@ -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.)
|
||||
*
|
||||
@ -1963,7 +1963,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)
|
||||
@ -1985,7 +1985,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)
|
||||
@ -2014,6 +2014,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;
|
||||
@ -2022,6 +2023,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;
|
||||
@ -2941,7 +2943,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)
|
||||
@ -3259,8 +3261,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.29 [March 16, 2017]
|
||||
* 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 */
|
||||
@ -2934,7 +2935,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
* using the equation given in Poynton's ColorFAQ of 1998-01-04 at
|
||||
* <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008 but
|
||||
* versions dated 1998 through November 2002 have been archived at
|
||||
* http://web.archive.org/web/20000816232553/http://www.inforamp.net/
|
||||
* https://web.archive.org/web/20000816232553/www.inforamp.net/
|
||||
* ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
|
||||
* Charles Poynton poynton at poynton.com
|
||||
*
|
||||
@ -4601,7 +4602,9 @@ png_do_expand_16(png_row_infop row_info, png_bytep row)
|
||||
png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */
|
||||
png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */
|
||||
while (dp > sp)
|
||||
dp[-2] = dp[-1] = *--sp, dp -= 2;
|
||||
{
|
||||
dp[-2] = dp[-1] = *--sp; dp -= 2;
|
||||
}
|
||||
|
||||
row_info->rowbytes *= 2;
|
||||
row_info->bit_depth = 16;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
* 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.)
|
||||
@ -2014,6 +2014,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)
|
||||
@ -2542,6 +2580,9 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
|
||||
png_ptr->mode |= PNG_AFTER_IDAT;
|
||||
|
||||
/* Note, "length" is sufficient here; we won't be adding
|
||||
* a null terminator later.
|
||||
*/
|
||||
buffer = png_read_buffer(png_ptr, length, 2/*silent*/);
|
||||
|
||||
if (buffer == NULL)
|
||||
@ -3154,7 +3195,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.
|
||||
@ -3163,7 +3204,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
|
||||
@ -3556,7 +3597,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
*/
|
||||
do
|
||||
{
|
||||
dp[0] = sp[0], dp[1] = sp[1];
|
||||
dp[0] = sp[0]; dp[1] = sp[1];
|
||||
|
||||
if (row_width <= bytes_to_jump)
|
||||
return;
|
||||
@ -3577,7 +3618,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2];
|
||||
dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2];
|
||||
|
||||
if (row_width <= bytes_to_jump)
|
||||
return;
|
||||
@ -4066,7 +4107,10 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
|
||||
/* Find the best predictor, the least of pa, pb, pc favoring the earlier
|
||||
* ones in the case of a tie.
|
||||
*/
|
||||
if (pb < pa) pa = pb, a = b;
|
||||
if (pb < pa)
|
||||
{
|
||||
pa = pb; a = b;
|
||||
}
|
||||
if (pc < pa) a = c;
|
||||
|
||||
/* Calculate the current pixel in a, and move the previous row pixel to c
|
||||
@ -4118,7 +4162,10 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
|
||||
#endif
|
||||
|
||||
if (pb < pa) pa = pb, a = b;
|
||||
if (pb < pa)
|
||||
{
|
||||
pa = pb; a = b;
|
||||
}
|
||||
if (pc < pa) a = c;
|
||||
|
||||
a += *row;
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
* 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,
|
||||
@ -1107,8 +1140,9 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||
info_ptr->valid |= PNG_INFO_sPLT;
|
||||
++(info_ptr->splt_palettes_num);
|
||||
++np;
|
||||
++entries;
|
||||
}
|
||||
while (++entries, --nentries);
|
||||
while (--nentries);
|
||||
|
||||
if (nentries > 0)
|
||||
png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
|
||||
@ -1841,14 +1875,16 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||
png_byte ch = (png_byte)*key++;
|
||||
|
||||
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
|
||||
*new_key++ = ch, ++key_len, space = 0;
|
||||
{
|
||||
*new_key++ = ch; ++key_len; space = 0;
|
||||
}
|
||||
|
||||
else if (space == 0)
|
||||
{
|
||||
/* A space or an invalid character when one wasn't seen immediately
|
||||
* before; output just a space.
|
||||
*/
|
||||
*new_key++ = 32, ++key_len, space = 1;
|
||||
*new_key++ = 32; ++key_len; space = 1;
|
||||
|
||||
/* If the character was not a space then it is invalid. */
|
||||
if (ch != 32)
|
||||
@ -1861,7 +1897,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||
|
||||
if (key_len > 0 && space != 0) /* trailing space */
|
||||
{
|
||||
--key_len, --new_key;
|
||||
--key_len; --new_key;
|
||||
if (bad_character == 0)
|
||||
bad_character = 32;
|
||||
}
|
||||
|
@ -500,5 +500,8 @@ struct png_struct_def
|
||||
png_colorspace colorspace;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* New member added in libpng-1.6.31 */
|
||||
int num_exif;
|
||||
};
|
||||
#endif /* PNGSTRUCT_H */
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* 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.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.)
|
||||
*
|
||||
@ -514,11 +514,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
++sp;
|
||||
else /* Skip initial channel and, for sp, the filler */
|
||||
sp += 2, ++dp;
|
||||
{
|
||||
sp += 2; ++dp;
|
||||
}
|
||||
|
||||
/* For a 1 pixel wide image there is nothing to do */
|
||||
while (sp < ep)
|
||||
*dp++ = *sp, sp += 2;
|
||||
{
|
||||
*dp++ = *sp; sp += 2;
|
||||
}
|
||||
|
||||
row_info->pixel_depth = 8;
|
||||
}
|
||||
@ -528,10 +532,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
sp += 2;
|
||||
else /* Skip initial channel and, for sp, the filler */
|
||||
sp += 4, dp += 2;
|
||||
{
|
||||
sp += 4; dp += 2;
|
||||
}
|
||||
|
||||
while (sp < ep)
|
||||
*dp++ = *sp++, *dp++ = *sp, sp += 3;
|
||||
{
|
||||
*dp++ = *sp++; *dp++ = *sp; sp += 3;
|
||||
}
|
||||
|
||||
row_info->pixel_depth = 16;
|
||||
}
|
||||
@ -554,11 +562,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
++sp;
|
||||
else /* Skip initial channels and, for sp, the filler */
|
||||
sp += 4, dp += 3;
|
||||
{
|
||||
sp += 4; dp += 3;
|
||||
}
|
||||
|
||||
/* Note that the loop adds 3 to dp and 4 to sp each time. */
|
||||
while (sp < ep)
|
||||
*dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
|
||||
{
|
||||
*dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2;
|
||||
}
|
||||
|
||||
row_info->pixel_depth = 24;
|
||||
}
|
||||
@ -568,14 +580,16 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
sp += 2;
|
||||
else /* Skip initial channels and, for sp, the filler */
|
||||
sp += 8, dp += 6;
|
||||
{
|
||||
sp += 8; dp += 6;
|
||||
}
|
||||
|
||||
while (sp < ep)
|
||||
{
|
||||
/* Copy 6 bytes, skip 2 */
|
||||
*dp++ = *sp++, *dp++ = *sp++;
|
||||
*dp++ = *sp++, *dp++ = *sp++;
|
||||
*dp++ = *sp++, *dp++ = *sp, sp += 3;
|
||||
*dp++ = *sp++; *dp++ = *sp++;
|
||||
*dp++ = *sp++; *dp++ = *sp++;
|
||||
*dp++ = *sp++; *dp++ = *sp; sp += 3;
|
||||
}
|
||||
|
||||
row_info->pixel_depth = 48;
|
||||
|
@ -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.)
|
||||
*
|
||||
@ -1016,8 +1016,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;
|
||||
|
||||
@ -1884,7 +1884,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];
|
||||
@ -1895,7 +1895,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];
|
||||
|
@ -1008,13 +1008,16 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
||||
optimize_cmf(data, png_image_size(png_ptr));
|
||||
#endif
|
||||
|
||||
if (size > 0)
|
||||
#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
if (png_ptr->num_frames_written == 0)
|
||||
{
|
||||
if (png_ptr->num_frames_written == 0)
|
||||
#endif
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
else
|
||||
png_write_fdAT(png_ptr, data, size);
|
||||
else
|
||||
png_write_fdAT(png_ptr, data, size);
|
||||
}
|
||||
#endif /* WRITE_APNG */
|
||||
|
||||
png_ptr->mode |= PNG_HAVE_IDAT;
|
||||
@ -1062,13 +1065,16 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
||||
optimize_cmf(data, png_image_size(png_ptr));
|
||||
#endif
|
||||
|
||||
if (size > 0)
|
||||
#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
if (png_ptr->num_frames_written == 0)
|
||||
{
|
||||
if (png_ptr->num_frames_written == 0)
|
||||
#endif
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
#ifdef PNG_WRITE_APNG_SUPPORTED
|
||||
else
|
||||
png_write_fdAT(png_ptr, data, size);
|
||||
else
|
||||
png_write_fdAT(png_ptr, data, size);
|
||||
}
|
||||
#endif /* WRITE_APNG */
|
||||
|
||||
png_ptr->zstream.avail_out = 0;
|
||||
@ -1492,6 +1498,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 */
|
||||
|
@ -46,7 +46,7 @@ _SUBDIR_CONFIG_ARGS="$ac_configure_args"
|
||||
dnl Set the version number of the libs included with mozilla
|
||||
dnl ========================================================
|
||||
MOZJPEG=62
|
||||
MOZPNG=10629
|
||||
MOZPNG=10631
|
||||
NSPR_VERSION=4
|
||||
NSPR_MINVER=4.16
|
||||
NSS_VERSION=3
|
||||
|
Loading…
x
Reference in New Issue
Block a user