diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2014-12-13 20:28:24 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2014-12-13 20:28:24 +0000 |
commit | d2d798d0f11abcbf141db69869e76e8d123ec1eb (patch) | |
tree | cee8645964030b4b80231952885911f724850d12 /plugins/AdvaImg/src/LibPNG | |
parent | a400ebf572dcad9b43d1b641b1742814f8b5e8a5 (diff) |
FreeImage updated to 3.16
git-svn-id: http://svn.miranda-ng.org/main/trunk@11379 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AdvaImg/src/LibPNG')
33 files changed, 2334 insertions, 2859 deletions
diff --git a/plugins/AdvaImg/src/LibPNG/ANNOUNCE b/plugins/AdvaImg/src/LibPNG/ANNOUNCE index 6ea2c2abcc..bfd62d13c3 100644 --- a/plugins/AdvaImg/src/LibPNG/ANNOUNCE +++ b/plugins/AdvaImg/src/LibPNG/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.3 - July 18, 2013
+Libpng 1.6.10 - March 6, 2014
This is a public release of libpng, intended for use in production codes.
@@ -8,106 +8,80 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a
"configure" script
- libpng-1.6.3.tar.xz (LZMA-compressed, recommended)
- libpng-1.6.3.tar.gz
+ libpng-1.6.10.tar.xz (LZMA-compressed, recommended)
+ libpng-1.6.10.tar.gz
Source files with CRLF line endings (for Windows), without the
"configure" script
- lpng163.7z (LZMA-compressed, recommended)
- lpng163.zip
+ lpng1610.7z (LZMA-compressed, recommended)
+ lpng1610.zip
Other information:
- libpng-1.6.3-README.txt
- libpng-1.6.3-LICENSE.txt
+ libpng-1.6.10-README.txt
+ libpng-1.6.10-LICENSE.txt
+ libpng-1.6.10-*.asc (armored detached GPG signatures)
-Changes since the last public release (1.6.2):
-
- Revised stack marking in arm/filter_neon.S and configure.ac.
- Ensure that NEON filter stuff is completely disabled when switched 'off'.
- Previously the ARM NEON specific files were still built if the option
- was switched 'off' as opposed to being explicitly disabled.
- Test for 'arm*' not just 'arm' in the host_cpu configure variable.
- Rebuilt the configure scripts.
- Expanded manual paragraph about writing private chunks, particularly
- the need to call png_set_keep_unknown_chunks() when writing them.
- Avoid dereferencing NULL pointer possibly returned from
- png_create_write_struct() (Andrew Church).
- Calculate our own zlib windowBits when decoding rather than trusting the
- CMF bytes in the PNG datastream.
- Added an option to force maximum window size for inflating, which was
- the behavior of libpng15 and earlier.
- Added png-fix-itxt and png-fix-too-far-back to the built programs and
- removed warnings from the source code and timepng that are revealed as
- a result.
- Detect wrong libpng versions linked to png-fix-too-far-back, which currently
- only works with libpng versions that can be made to reliably fail when
- the deflate data contains an out-of-window reference. This means only
- 1.6 and later.
- Fixed gnu issues: g++ needs a static_cast, gcc 4.4.7 has a broken warning
- message which it is easier to work round than ignore.
- Updated contrib/pngminus/pnm2png.c (Paul Stewart):
- Check for EOF
- Ignore "#" delimited comments in input file to pnm2png.c.
- Fixed whitespace handling
- Added a call to png_set_packing()
- Initialize dimension values so if sscanf fails at least we have known
- invalid values.
- Attempt to detect configuration issues with png-fix-too-far-back, which
- requires both the correct libpng and the correct zlib to function
- correctly.
- Check ZLIB_VERNUM for mismatches, enclose #error in quotes
- Added information in the documentation about problems with and fixes for
- the bad CRC and bad iTXt chunk situations.
- Allow contrib/pngminus/pnm2png.c to compile without WRITE_INVERT and
- WRITE_PACK supported (writes error message that it can't read P1 or
- Improved png-fix-too-far-back usage message, added --suffix option.
- Revised contrib/pngminim/*/makefile to generate pnglibconf.h with the
- right zlib header files.
- Separated CPPFLAGS and CFLAGS in contrib/pngminim/*/makefile
- Removed a redundant test in png_set_IHDR().
- Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt (Andrew Hundt)
- Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt
- Enclose the prototypes for the simplified write API in
- #ifdef PNG_STDIO_SUPPORTED/#endif
- Make ARM NEON support work at compile time (not just configure time).
- This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when
- using a compiler that compiles for multiple architectures at one time.
- Removed PNG_FILTER_OPTIMIZATIONS and PNG_ARM_NEON_SUPPORTED from
- pnglibconf.h, allowing more of the decisions to be made internally
- (pngpriv.h) during the compile. Without this, symbol prefixing is broken
- under certain circumstances on ARM platforms. Now only the API parts of
- the optimizations ('check' vs 'api') are exposed in the public header files
- except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
- decision about whether or not to use the optimizations.
- Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
- Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
- on __ARM_NEON__ from configure time to compile time. This breaks symbol
- prefixing because the definition of the special png_init_filter_functions
- call was hidden at configure time if the relevant compiler arguments are
- passed in CFLAGS as opposed to CC. This change attempts to avoid all
- the confusion that would result by declaring the init function even when
- it is not used, so that it will always get prefixed.
- Revised libpng.3 so that "doclifter" can process it.
- Revised example.c to illustrate use of PNG_DEFAULT_sRGB and PNG_GAMMA_MAC_18
- as parameters for png_set_gamma(). These have been available since
- libpng-1.5.4.
- Renamed contrib/tools/png-fix-too-far-back.c to pngfix.c and revised it
- to check all compressed chunks known to libpng.
- Updated documentation to show default behavior of benign errors correctly.
- Only compile ARM code when PNG_READ_SUPPORTED is defined.
- Fixed undefined behavior in contrib/tools/pngfix.c and added new strip
- option. pngfix relied on undefined behavior and even a simple change from
- gcc to g++ caused it to fail. The new strip option 'unsafe' has been
- implemented and is the default if --max is given. Option names have
- been clarified, with --strip=transform now stripping the bKGD chunk,
- which was stripped previously with --strip=unused.
- Added all documented chunk types to pngpriv.h
- Unified pngfix.c source with libpng17.
- Revised manual about changes in iTXt chunk handling made in libpng-1.6.0.
- Added "/* SAFE */" comments in pngrutil.c and pngrtran.c where warnings
- may be erroneously issued by code-checking applications.
+Changes since the last public release (1.6.9):
+ Backported changes from libpng-1.7.0beta30 and beta31:
+ Fixed a large number of instances where PNGCBAPI was omitted from
+ function definitions.
+ Added pngimage test program for png_read_png() and png_write_png()
+ with two new test scripts.
+ Removed dependence on !PNG_READ_EXPAND_SUPPORTED for calling
+ png_set_packing() in png_read_png().
+ Fixed combination of ~alpha with shift. On read invert alpha, processing
+ occurred after shift processing, which causes the final values to be
+ outside the range that should be produced by the shift. Reversing the
+ order on read makes the two transforms work together correctly and mirrors
+ the order used on write.
+ Do not read invalid sBIT chunks. Previously libpng only checked sBIT
+ values on write, so a malicious PNG writer could therefore cause
+ the read code to return an invalid sBIT chunk, which might lead to
+ application errors or crashes. Such chunks are now skipped (with
+ chunk_benign_error).
+ Make png_read_png() and png_write_png() prototypes in png.h depend
+ upon PNG_READ_SUPPORTED and PNG_WRITE_SUPPORTED.
+ Support builds with unsupported PNG_TRANSFORM_* values. All of the
+ PNG_TRANSFORM_* values are always defined in png.h and, because they
+ are used for both read and write in some cases, it is not reliable
+ to #if out ones that are totally unsupported. This change adds error
+ detection in png_read_image() and png_write_image() to do a
+ png_app_error() if the app requests something that cannot be done
+ and it adds corresponding code to pngimage.c to handle such options
+ by not attempting to test them.
+ Moved redefines of png_error(), png_warning(), png_chunk_error(),
+ and png_chunk_warning() from pngpriv.h to png.h to make them visible
+ to libpng-calling applications.
+ Moved OS dependent code from arm/arm_init.c, to allow the included
+ implementation of the ARM NEON discovery function to be set at
+ build-time and provide sample implementations from the current code in the
+ contrib/arm-neon subdirectory. The __linux__ code has also been changed to
+ compile and link on Android by using /proc/cpuinfo, and the old linux code
+ is in contrib/arm-neon/linux-auxv.c. The new code avoids POSIX and Linux
+ dependencies apart from opening /proc/cpuinfo and is C90 compliant.
+ Check for info_ptr == NULL early in png_read_end() so we don't need to
+ run all the png_handle_*() and depend on them to return if info_ptr == NULL.
+ This improves the performance of png_read_end(png_ptr, NULL) and makes
+ it more robust against future programming errors.
+ Check for __has_extension before using it in pngconf.h, to
+ support older Clang versions (Jeremy Sequoia).
+ Treat CRC error handling with png_set_crc_action(), instead of with
+ png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
+ Use a user warning handler in contrib/gregbook/readpng2.c instead of default,
+ so warnings will be put on stderr even if libpng has CONSOLE_IO disabled.
+ Added png_ptr->process_mode = PNG_READ_IDAT_MODE in png_push_read_chunk
+ after recognizing the IDAT chunk, which avoids an infinite loop while
+ reading a datastream whose first IDAT chunk is of zero-length.
+ This fixes CERT VU#684412 and CVE-2014-0333.
+ Don't recognize known sRGB profiles as sRGB if they have been hacked,
+ but don't reject them and don't issue a copyright violation warning.
+ Moved some documentation from png.h to libpng.3 and libpng-manual.txt
+ Minor editing of contrib/arm-neon/README and contrib/examples/*.c
+ Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
+ and PNG_USR_CONFIG -> PNG_USER_CONFIG).
+ Un-deprecated png_data_freer().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
@@ -116,3 +90,4 @@ to subscribe) or to glennrp at users.sourceforge.net
Glenn R-P
+#endif
diff --git a/plugins/AdvaImg/src/LibPNG/CHANGES b/plugins/AdvaImg/src/LibPNG/CHANGES index 0d6e5feea3..8d9a4f3556 100644 --- a/plugins/AdvaImg/src/LibPNG/CHANGES +++ b/plugins/AdvaImg/src/LibPNG/CHANGES @@ -4618,6 +4618,262 @@ Version 1.6.3 [July 18, 2013] Added "/* SAFE */" comments in pngrutil.c and pngrtran.c where warnings
may be erroneously issued by code-checking applications.
+Version 1.6.4beta01 [August 21, 2013]
+ Added information about png_set_options() to the manual.
+ Delay calling png_init_filter_functions() until a row with nonzero filter
+ is found.
+
+Version 1.6.4beta02 [August 30, 2013]
+ Fixed inconsistent conditional compilation of png_chunk_unknown_handling()
+ prototype, definition, and usage. Made it depend on
+ PNG_HANDLE_AS_UNKNOWN_SUPPORTED everywhere.
+
+Version 1.6.4rc01 [September 5, 2013]
+ No changes.
+
+Version 1.6.4 [September 12, 2013]
+ No changes.
+
+Version 1.6.5 [September 14, 2013]
+ Removed two stray lines of code from arm/arm_init.c.
+
+Version 1.6.6 [September 16, 2013]
+ Removed two stray lines of code from arm/arm_init.c, again.
+
+Version 1.6.7beta01 [September 30, 2013]
+ Revised unknown chunk code to correct several bugs in the NO_SAVE_/NO_WRITE
+ combination
+ Allow HANDLE_AS_UNKNOWN to work when other options are configured off. Also
+ fixed the pngminim makefiles to work when $(MAKEFLAGS) contains stuff
+ which terminates the make options (as by default in recent versions of
+ Gentoo).
+ Avoid up-cast warnings in pngvalid.c. On ARM the alignment requirements of
+ png_modifier are greater than that of png_store and as a consequence
+ compilation of pngvalid.c results in a warning about increased alignment
+ requirements because of the bare cast to (png_modifier*). The code is safe,
+ because the pointer is known to point to a stack allocated png_modifier,
+ but this change avoids the warning.
+ Fixed default behavior of ARM_NEON_API. If the ARM NEON API option was
+ compiled without the CHECK option it defaulted to on, not off.
+ Check user callback behavior in pngunknown.c. Previous versions compiled
+ if SAVE_UNKNOWN was not available but did nothing since the callback
+ was never implemented.
+ Merged pngunknown.c with 1.7 version and back ported 1.7 improvements/fixes
+
+Version 1.6.7beta02 [October 12, 2013]
+ Made changes for compatibility with automake 1.14:
+ 1) Added the 'compile' program to the list of programs that must be cleaned
+ in autogen.sh
+ 2) Added 'subdir-objects' which causes .c files in sub-directories to be
+ compiled such that the corresponding .o files are also in the
+ sub-directory. This is because automake 1.14 warns that the
+ current behavior of compiling to the top level directory may be removed
+ in the future.
+ 3) Updated dependencies on pnglibconf.h to match the new .o locations and
+ added all the files in contrib/libtests and contrib/tools that depend
+ on pnglibconf.h
+ 4) Added 'BUILD_SOURCES = pnglibconf.h'; this is the automake recommended
+ way of handling the dependencies of sources that are machine generated;
+ unfortunately it only works if the user does 'make all' or 'make check',
+ so the dependencies (3) are still required.
+ Cleaned up (char*) casts of zlib messages. The latest version of the Intel C
+ compiler complains about casting a string literal as (char*), so copied the
+ treatment of z_const from the library code into pngfix.c
+ Simplified error message code in pngunknown. The simplification has the
+ useful side effect of avoiding a bogus warning generated by the latest
+ version of the Intel C compiler (it objects to
+ condition ? string-literal : string-literal).
+ Make autogen.sh work with automake 1.13 as well as 1.14. Do this by always
+ removing the 1.14 'compile' script but never checking for it.
+
+Version 1.6.7beta03 [October 19, 2013]
+ Added ARMv8 support (James Yu <james.yu at linaro.org>). Added file
+ arm/filter_neon_intrinsics.c; enable with -mfpu=neon.
+ Revised pngvalid to generate size images with as many filters as it can
+ manage, limited by the number of rows.
+ Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h
+ and detect the broken GCC compilers.
+
+Version 1.6.7beta04 [October 26, 2013]
+ Allow clang derived from older GCC versions to use ARM intrinsics. This
+ causes all clang builds that use -mfpu=neon to use the intrinsics code,
+ not the assembler code. This has only been tested on iOS 7. It may be
+ necessary to exclude some earlier clang versions but this seems unlikely.
+ Changed NEON implementation selection mechanism. This allows assembler
+ or intrinsics to be turned on at compile time during the build by defining
+ PNG_ARM_NEON_IMPLEMENTATION to the correct value (2 or 1). This macro
+ is undefined by default and the build type is selected in pngpriv.h.
+
+Version 1.6.7rc01 [November 2, 2013]
+ No changes.
+
+Version 1.6.7rc02 [November 7, 2013]
+ Fixed #include in filter_neon_intrinsics.c and ctype macros. The ctype char
+ checking macros take an unsigned char argument, not a signed char.
+
+Version 1.6.7 [November 14, 2013]
+ No changes.
+
+Version 1.6.8beta01 [November 24, 2013]
+ Moved prototype for png_handle_unknown() in pngpriv.h outside of
+ the #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED/#endif block.
+ Added "-Wall" to CFLAGS in contrib/pngminim/*/makefile
+ Conditionally compile some unused functions reported by -Wall in
+ pngminim.
+ Fixed 'minimal' builds. Various obviously useful minimal configurations
+ don't build because of missing contrib/libtests test programs and
+ overly complex dependencies in scripts/pnglibconf.dfa. This change
+ adds contrib/conftest/*.dfa files that can be used in automatic build
+ scripts to ensure that these configurations continue to build.
+ Enabled WRITE_INVERT and WRITE_PACK in contrib/pngminim/encoder.
+ Fixed pngvalid 'fail' function declaration on the Intel C Compiler.
+ This reverts to the previous 'static' implementation and works round
+ the 'unused static function' warning by using PNG_UNUSED().
+
+Version 1.6.8beta02 [November 30, 2013]
+ Removed or marked PNG_UNUSED some harmless "dead assignments" reported
+ by clang scan-build.
+ Changed tabs to 3 spaces in png_debug macros and changed '"%s"m'
+ to '"%s" m' to improve portability among compilers.
+ Changed png_free_default() to free() in pngtest.c
+
+Version 1.6.8rc01 [December 12, 2013]
+ Tidied up pngfix inits and fixed pngtest no-write builds.
+
+Version 1.6.8rc02 [December 14, 2013]
+ Handle zero-length PLTE chunk or NULL palette with png_error()
+ instead of png_chunk_report(), which by default issues a warning
+ rather than an error, leading to later reading from a NULL pointer
+ (png_ptr->palette) in png_do_expand_palette(). This is CVE-2013-6954
+ and VU#650142. Libpng-1.6.1 through 1.6.7 are vulnerable.
+ Libpng-1.6.0 and earlier do not have this bug.
+
+Version 1.6.8 [December 19, 2013]
+ No changes.
+
+Version 1.6.9beta01 [December 26, 2013]
+ Bookkeeping: Moved functions around (no changes). Moved transform
+ function definitions before the place where they are called so that
+ they can be made static. Move the intrapixel functions and the
+ grayscale palette builder out of the png?tran.c files. The latter
+ isn't a transform function and is no longer used internally, and the
+ former MNG specific functions are better placed in pngread/pngwrite.c
+ Made transform implementation functions static. This makes the internal
+ functions called by png_do_{read|write}_transformations static. On an
+ x86-64 DLL build (Gentoo Linux) this reduces the size of the text
+ segment of the DLL by 1208 bytes, about 0.6%. It also simplifies
+ maintenance by removing the declarations from pngpriv.h and allowing
+ easier changes to the internal interfaces.
+ Rebuilt configure scripts with automake-1.14.1 and autoconf-2.69
+ in the tar distributions.
+
+Version 1.6.9beta02 [January 1, 2014]
+ Added checks for libpng 1.5 to pngvalid.c. This supports the use of
+ this version of pngvalid in libpng 1.5
+ Merged with pngvalid.c from libpng-1.7 changes to create a single
+ pngvalid.c
+ Removed #error macro from contrib/tools/pngfix.c (Thomas Klausner).
+ Merged pngrio.c, pngtrans.c, pngwio.c, and pngerror.c with libpng-1.7.0
+ Merged libpng-1.7.0 changes to make no-interlace configurations work
+ with test programs.
+ Revised pngvalid.c to support libpng 1.5, which does not support the
+ PNG_MAXIMUM_INFLATE_WINDOW option, so #define it out when appropriate in
+ pngvalid.c
+ Allow unversioned links created on install to be disabled in configure.
+ In configure builds 'make install' changes/adds links like png.h
+ and libpng.a to point to the newly installed, versioned, files (e.g.
+ libpng17/png.h and libpng17.a). Three new configure options and some
+ rearrangement of Makefile.am allow creation of these links to be disabled.
+
+Version 1.6.9beta03 [January 10, 2014]
+ Removed potentially misleading warning from png_check_IHDR().
+
+Version 1.6.9beta04 [January 20, 2014]
+ Updated scripts/makefile.* to use CPPFLAGS (Cosmin).
+ Added clang attribute support (Cosmin).
+
+Version 1.6.9rc01 [January 28, 2014]
+ No changes.
+
+Version 1.6.9rc02 [January 30, 2014]
+ Quiet an uninitialized memory warning from VC2013 in png_get_png().
+
+Version 1.6.9 [February 6, 2014]
+
+Version 1.6.10beta01 [February 9, 2014]
+ Backported changes from libpng-1.7.0beta30 and beta31:
+ Fixed a large number of instances where PNGCBAPI was omitted from
+ function definitions.
+ Added pngimage test program for png_read_png() and png_write_png()
+ with two new test scripts.
+ Removed dependence on !PNG_READ_EXPAND_SUPPORTED for calling
+ png_set_packing() in png_read_png().
+ Fixed combination of ~alpha with shift. On read invert alpha, processing
+ occurred after shift processing, which causes the final values to be
+ outside the range that should be produced by the shift. Reversing the
+ order on read makes the two transforms work together correctly and mirrors
+ the order used on write.
+ Do not read invalid sBIT chunks. Previously libpng only checked sBIT
+ values on write, so a malicious PNG writer could therefore cause
+ the read code to return an invalid sBIT chunk, which might lead to
+ application errors or crashes. Such chunks are now skipped (with
+ chunk_benign_error).
+ Make png_read_png() and png_write_png() prototypes in png.h depend
+ upon PNG_READ_SUPPORTED and PNG_WRITE_SUPPORTED.
+ Support builds with unsupported PNG_TRANSFORM_* values. All of the
+ PNG_TRANSFORM_* values are always defined in png.h and, because they
+ are used for both read and write in some cases, it is not reliable
+ to #if out ones that are totally unsupported. This change adds error
+ detection in png_read_image() and png_write_image() to do a
+ png_app_error() if the app requests something that cannot be done
+ and it adds corresponding code to pngimage.c to handle such options
+ by not attempting to test them.
+
+Version 1.6.10beta02 [February 23, 2014]
+ Moved redefines of png_error(), png_warning(), png_chunk_error(),
+ and png_chunk_warning() from pngpriv.h to png.h to make them visible
+ to libpng-calling applications.
+ Moved OS dependent code from arm/arm_init.c, to allow the included
+ implementation of the ARM NEON discovery function to be set at
+ build-time and provide sample implementations from the current code in the
+ contrib/arm-neon subdirectory. The __linux__ code has also been changed to
+ compile and link on Android by using /proc/cpuinfo, and the old linux code
+ is in contrib/arm-neon/linux-auxv.c. The new code avoids POSIX and Linux
+ dependencies apart from opening /proc/cpuinfo and is C90 compliant.
+ Check for info_ptr == NULL early in png_read_end() so we don't need to
+ run all the png_handle_*() and depend on them to return if info_ptr == NULL.
+ This improves the performance of png_read_end(png_ptr, NULL) and makes
+ it more robust against future programming errors.
+ Check for __has_extension before using it in pngconf.h, to
+ support older Clang versions (Jeremy Sequoia).
+ Treat CRC error handling with png_set_crc_action(), instead of with
+ png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
+ Use a user warning handler in contrib/gregbook/readpng2.c instead of default,
+ so warnings will be put on stderr even if libpng has CONSOLE_IO disabled.
+ Added png_ptr->process_mode = PNG_READ_IDAT_MODE in png_push_read_chunk
+ after recognizing the IDAT chunk, which avoids an infinite loop while
+ reading a datastream whose first IDAT chunk is of zero-length.
+ This fixes CERT VU#684412 and CVE-2014-0333.
+ Don't recognize known sRGB profiles as sRGB if they have been hacked,
+ but don't reject them and don't issue a copyright violation warning.
+
+Version 1.6.10beta03 [February 25, 2014]
+ Moved some documentation from png.h to libpng.3 and libpng-manual.txt
+ Minor editing of contrib/arm-neon/README and contrib/examples/*.c
+
+Version 1.6.10rc01 [February 27, 2014]
+ Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
+ and PNG_USR_CONFIG -> PNG_USER_CONFIG).
+
+Version 1.6.10rc02 [February 28, 2014]
+ Removed unreachable return statement after png_chunk_error()
+ in pngrutil.c
+
+Version 1.6.10rc03 [March 4, 2014]
+ Un-deprecated png_data_freer().
+
+Version 1.6.10 [March 6, 2014]
+
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/plugins/AdvaImg/src/LibPNG/LICENSE b/plugins/AdvaImg/src/LibPNG/LICENSE index 5b289d1a01..ea1841e479 100644 --- a/plugins/AdvaImg/src/LibPNG/LICENSE +++ b/plugins/AdvaImg/src/LibPNG/LICENSE @@ -10,8 +10,8 @@ this sentence. This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.6.3, July 18, 2013, are
-Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
+libpng versions 1.2.6, August 15, 2004, through 1.6.10, March 6, 2014, are
+Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-July 18, 2013
+March 6, 2014
diff --git a/plugins/AdvaImg/src/LibPNG/README b/plugins/AdvaImg/src/LibPNG/README index a60e6b70fe..d7b19371f9 100644 --- a/plugins/AdvaImg/src/LibPNG/README +++ b/plugins/AdvaImg/src/LibPNG/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.3 - July 18, 2013 (shared library 16.0)
+README for libpng version 1.6.10 - March 6, 2014 (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.
@@ -121,7 +121,7 @@ and ...". If in doubt, send questions to me. I'll bounce them to others, if necessary.
Please do not send suggestions on how to change PNG. We have
-been discussing PNG for eighteen years now, and it is official and
+been discussing PNG for nineteen years now, and it is official and
finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately,
it may be used later.
diff --git a/plugins/AdvaImg/src/LibPNG/TODO b/plugins/AdvaImg/src/LibPNG/TODO index b1660a413a..4659b70d81 100644 --- a/plugins/AdvaImg/src/LibPNG/TODO +++ b/plugins/AdvaImg/src/LibPNG/TODO @@ -10,6 +10,7 @@ Add "grayscale->palette" transformation and "palette->grayscale" detection. Improved dithering.
Multi-lingual error and warning message support.
Complete sRGB transformation (presently it simply uses gamma=0.45455).
+Make profile checking optional via a png_set_something() call.
Man pages for function calls.
Better documentation.
Better filter selection
diff --git a/plugins/AdvaImg/src/LibPNG/configure b/plugins/AdvaImg/src/LibPNG/configure index c654a18976..4dbd0267d7 100644 --- a/plugins/AdvaImg/src/LibPNG/configure +++ b/plugins/AdvaImg/src/LibPNG/configure @@ -1,14 +1,14 @@ echo "
There is no \"configure\" script in this distribution (*.zip or *.7z) of
- libpng-1.6.3.
+ libpng-1.6.10.
Instead, please copy the appropriate makefile for your system from the
\"scripts\" directory. Read the INSTALL file for more details.
Update, July 2004: you can get a \"configure\" based distribution
from the libpng distribution sites. Download the file
- libpng-1.6.3.tar.gz, libpng-1.6.3.tar.xz, or libpng-1.6.3.tar.bz2
+ libpng-1.6.10.tar.gz, libpng-1.6.10.tar.xz, or libpng-1.6.10.tar.bz2
If the line endings in the files look funny, which is likely to be the
case if you were trying to run \"configure\" on a Linux machine, you may
diff --git a/plugins/AdvaImg/src/LibPNG/libpng-manual.txt b/plugins/AdvaImg/src/LibPNG/libpng-manual.txt index 326cebb2da..c8cd50393e 100644 --- a/plugins/AdvaImg/src/LibPNG/libpng-manual.txt +++ b/plugins/AdvaImg/src/LibPNG/libpng-manual.txt @@ -1,9 +1,9 @@ libpng-manual.txt - A description on how to use and modify libpng
- libpng version 1.6.3 - July 18, 2013
+ libpng version 1.6.10 - March 6, 2014
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
- Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ Copyright (c) 1998-2014 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.3 - July 18, 2013
+ libpng versions 0.97, January 1998, through 1.6.10 - March 6, 2014
Updated and distributed by Glenn Randers-Pehrson
- Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ Copyright (c) 1998-2014 Glenn Randers-Pehrson
libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger
@@ -274,10 +274,10 @@ This method of building a customized pnglibconf.h is illustrated in contrib/pngminim/*. See the "$(PNGCONF):" target in the makefile and
pngusr.dfa in these directories.
-C. Configuration using PNG_USR_CONFIG
+C. Configuration using PNG_USER_CONFIG
-If -DPNG_USR_CONFIG is added to the CFLAGS when pnglibconf.h is built the file
-pngusr.h will automatically be included before the options in
+If -DPNG_USER_CONFIG is added to the CPPFLAGS when pnglibconf.h is built,
+the file pngusr.h will automatically be included before the options in
scripts/pnglibconf.dfa are processed. Your pngusr.h file should contain only
macro definitions turning features on or off or setting settings.
@@ -712,12 +712,12 @@ value. You can also specify a default encoding for the PNG file in case the required information is missing from the file. By default libpng
assumes that the PNG data matches your system, to keep this default call:
- png_set_gamma(png_ptr, screen_gamma, 1/screen_gamma/*file gamma*/);
+ png_set_gamma(png_ptr, screen_gamma, output_gamma);
or you can use the fixed point equivalent:
png_set_gamma_fixed(png_ptr, PNG_FP_1*screen_gamma,
- PNG_FP_1/screen_gamma);
+ PNG_FP_1*output_gamma);
If you don't know the gamma for your system it is probably 2.2 - a good
approximation to the IEC standard for display systems (sRGB). If images are
@@ -740,11 +740,75 @@ situations: encoding.
You would use the linear (unencoded) value if you need to process the pixel
-values further because this avoids the need to decode and reencode each
+values further because this avoids the need to decode and re-encode each
component value whenever arithmetic is performed. A lot of graphics software
uses linear values for this reason, often with higher precision component values
to preserve overall accuracy.
+
+The output_gamma value expresses how to decode the output values, not how
+they are encoded. The values used correspond to the normal numbers used to
+describe the overall gamma of a computer display system; for example 2.2 for
+an sRGB conformant system. The values are scaled by 100000 in the _fixed
+version of the API (so 220000 for sRGB.)
+
+The inverse of the value is always used to provide a default for the PNG file
+encoding if it has no gAMA chunk and if png_set_gamma() has not been called
+to override the PNG gamma information.
+
+When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode
+opaque pixels however pixels with lower alpha values are not encoded,
+regardless of the output gamma setting.
+
+When the standard Porter Duff handling is requested with mode 1 the output
+encoding is set to be linear and the output_gamma value is only relevant
+as a default for input data that has no gamma information. The linear output
+encoding will be overridden if png_set_gamma() is called - the results may be
+highly unexpected!
+
+The following numbers are derived from the sRGB standard and the research
+behind it. sRGB is defined to be approximated by a PNG gAMA chunk value of
+0.45455 (1/2.2) for PNG. The value implicitly includes any viewing
+correction required to take account of any differences in the color
+environment of the original scene and the intended display environment; the
+value expresses how to *decode* the image for display, not how the original
+data was *encoded*.
+
+sRGB provides a peg for the PNG standard by defining a viewing environment.
+sRGB itself, and earlier TV standards, actually use a more complex transform
+(a linear portion then a gamma 2.4 power law) than PNG can express. (PNG is
+limited to simple power laws.) By saying that an image for direct display on
+an sRGB conformant system should be stored with a gAMA chunk value of 45455
+(11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification
+makes it possible to derive values for other display systems and
+environments.
+
+The Mac value is deduced from the sRGB based on an assumption that the actual
+extra viewing correction used in early Mac display systems was implemented as
+a power 1.45 lookup table.
+
+Any system where a programmable lookup table is used or where the behavior of
+the final display device characteristics can be changed requires system
+specific code to obtain the current characteristic. However this can be
+difficult and most PNG gamma correction only requires an approximate value.
+
+By default, if png_set_alpha_mode() is not called, libpng assumes that all
+values are unencoded, linear, values and that the output device also has a
+linear characteristic. This is only very rarely correct - it is invariably
+better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the
+default if you don't know what the right answer is!
+
+The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS
+10.6) which used a correction table to implement a somewhat lower gamma on an
+otherwise sRGB system.
+
+Both these values are reserved (not simple gamma values) in order to allow
+more precise correction internally in the future.
+
+NOTE: the values can be passed to either the fixed or floating
+point APIs, but the floating point API will also accept floating point
+values.
+
The second thing you may need to tell libpng about is how your system handles
alpha channel information. Some, but not all, PNG files contain an alpha
channel. To display these files correctly you need to compose the data onto a
@@ -769,11 +833,11 @@ by png_set_alpha_mode(). The mode is as follows:
- PNG_ALPHA_PNG: The data is encoded according to the PNG specification. Red,
-green and blue, or gray, components are gamma encoded color
-values and are not premultiplied by the alpha value. The
-alpha value is a linear measure of the contribution of the
-pixel to the corresponding final output pixel.
+ PNG_ALPHA_PNG: The data is encoded according to the PNG
+specification. Red, green and blue, or gray, components are
+gamma encoded color values and are not premultiplied by the
+alpha value. The alpha value is a linear measure of the
+contribution of the pixel to the corresponding final output pixel.
You should normally use this format if you intend to perform
color correction on the color values; most, maybe all, color
@@ -790,11 +854,35 @@ be used! The remaining modes assume you don't need to do any further color correction or
that if you do, your color correction software knows all about alpha (it
-probably doesn't!)
-
- PNG_ALPHA_STANDARD: The data libpng produces
-is encoded in the standard way
-assumed by most correctly written graphics software.
+probably doesn't!). They 'associate' the alpha with the color information by
+storing color channel values that have been scaled by the alpha. The
+advantage is that the color channels can be resampled (the image can be
+scaled) in this form. The disadvantage is that normal practice is to store
+linear, not (gamma) encoded, values and this requires 16-bit channels for
+still images rather than the 8-bit channels that are just about sufficient if
+gamma encoding is used. In addition all non-transparent pixel values,
+including completely opaque ones, must be gamma encoded to produce the final
+image. These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes
+described below (the latter being the two common names for associated alpha
+color channels). Note that PNG files always contain non-associated color
+channels; png_set_alpha_mode() with one of the modes causes the decoder to
+convert the pixels to an associated form before returning them to your
+application.
+
+Since it is not necessary to perform arithmetic on opaque color values so
+long as they are not to be resampled and are in the final color space it is
+possible to optimize the handling of alpha by storing the opaque pixels in
+the PNG format (adjusted for the output color space) while storing partially
+opaque pixels in the standard, linear, format. The accuracy required for
+standard alpha composition is relatively low, because the pixels are
+isolated, therefore typically the accuracy loss in storing 8-bit linear
+values is acceptable. (This is not true if the alpha channel is used to
+simulate transparency over large areas - use 16 bits or the PNG mode in
+this case!) This is the 'OPTIMIZED' mode. For this mode a pixel is
+treated as opaque only if the alpha value is equal to the maximum value.
+
+ PNG_ALPHA_STANDARD: The data libpng produces is encoded in the
+standard way assumed by most correctly written graphics software.
The gamma encoding will be removed by libpng and the
linear component values will be pre-multiplied by the
alpha channel.
@@ -823,9 +911,8 @@ dynamic range. To avoid problems, and if your software supports it, use png_set_expand_16() to force all
components to 16 bits.
- PNG_ALPHA_OPTIMIZED: This mode is the same
-as PNG_ALPHA_STANDARD except that
-completely opaque pixels are gamma encoded according to
+ PNG_ALPHA_OPTIMIZED: This mode is the same as PNG_ALPHA_STANDARD
+except that completely opaque pixels are gamma encoded according to
the screen_gamma value. Pixels with alpha less than 1.0
will still have linear components.
@@ -844,18 +931,16 @@ representation of non-opaque pixels are irrelevant. You can also try this format if your software is broken;
it might look better.
- PNG_ALPHA_BROKEN: This is PNG_ALPHA_STANDARD;
-however, all component values,
-including the alpha channel are gamma encoded. This is
-an appropriate format to try if your software, or more
-likely hardware, is totally broken, i.e., if it performs
-linear arithmetic directly on gamma encoded values.
-
-In most cases of broken software or hardware the bug in the final display
-manifests as a subtle halo around composited parts of the image. You may not
-even perceive this as a halo; the composited part of the image may simply appear
-separate from the background, as though it had been cut out of paper and pasted
-on afterward.
+ PNG_ALPHA_BROKEN: This is PNG_ALPHA_STANDARD; however, all component
+values, including the alpha channel are gamma encoded. This is
+broken because, in practice, no implementation that uses this choice
+correctly undoes the encoding before handling alpha composition. Use this
+choice only if other serious errors in the software or hardware you use
+mandate it. In most cases of broken software or hardware the bug in the
+final display manifests as a subtle halo around composited parts of the
+image. You may not even perceive this as a halo; the composited part of
+the image may simply appear separate from the background, as though it had
+been cut out of paper and pasted on afterward.
If you don't have to deal with bugs in software or hardware, or if you can fix
them, there are three recommended ways of using png_set_alpha_mode():
@@ -886,6 +971,89 @@ All you can do is compose the result onto a matching output. Since this mode is libpng-specific you also need to write your own composition
software.
+The following are examples of calls to png_set_alpha_mode to achieve the
+required overall gamma correction and, where necessary, alpha
+premultiplication.
+
+ png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
+
+This is the default libpng handling of the alpha channel - it is not
+pre-multiplied into the color components. In addition the call states
+that the output is for a sRGB system and causes all PNG files without gAMA
+chunks to be assumed to be encoded using sRGB.
+
+ png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
+
+In this case the output is assumed to be something like an sRGB conformant
+display preceeded by a power-law lookup table of power 1.45. This is how
+early Mac systems behaved.
+
+ png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
+
+This is the classic Jim Blinn approach and will work in academic
+environments where everything is done by the book. It has the shortcoming
+of assuming that input PNG data with no gamma information is linear - this
+is unlikely to be correct unless the PNG files where generated locally.
+Most of the time the output precision will be so low as to show
+significant banding in dark areas of the image.
+
+ png_set_expand_16(pp);
+ png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_DEFAULT_sRGB);
+
+This is a somewhat more realistic Jim Blinn inspired approach. PNG files
+are assumed to have the sRGB encoding if not marked with a gamma value and
+the output is always 16 bits per component. This permits accurate scaling
+and processing of the data. If you know that your input PNG files were
+generated locally you might need to replace PNG_DEFAULT_sRGB with the
+correct value for your system.
+
+ png_set_alpha_mode(pp, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB);
+
+If you just need to composite the PNG image onto an existing background
+and if you control the code that does this you can use the optimization
+setting. In this case you just copy completely opaque pixels to the
+output. For pixels that are not completely transparent (you just skip
+those) you do the composition math using png_composite or png_composite_16
+below then encode the resultant 8-bit or 16-bit values to match the output
+encoding.
+
+ Other cases
+
+If neither the PNG nor the standard linear encoding work for you because
+of the software or hardware you use then you have a big problem. The PNG
+case will probably result in halos around the image. The linear encoding
+will probably result in a washed out, too bright, image (it's actually too
+contrasty.) Try the ALPHA_OPTIMIZED mode above - this will probably
+substantially reduce the halos. Alternatively try:
+
+ png_set_alpha_mode(pp, PNG_ALPHA_BROKEN, PNG_DEFAULT_sRGB);
+
+This option will also reduce the halos, but there will be slight dark
+halos round the opaque parts of the image where the background is light.
+In the OPTIMIZED mode the halos will be light halos where the background
+is dark. Take your pick - the halos are unavoidable unless you can get
+your hardware/software fixed! (The OPTIMIZED approach is slightly
+faster.)
+
+When the default gamma of PNG files doesn't match the output gamma.
+If you have PNG files with no gamma information png_set_alpha_mode allows
+you to provide a default gamma, but it also sets the ouput gamma to the
+matching value. If you know your PNG files have a gamma that doesn't
+match the output you can take advantage of the fact that
+png_set_alpha_mode always sets the output gamma but only sets the PNG
+default if it is not already set:
+
+ png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
+ png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
+
+The first call sets both the default and the output gamma values, the
+second call overrides the output gamma without changing the default. This
+is easier than achieving the same effect with png_set_gamma. You must use
+PNG_ALPHA_PNG for the first call - internal checking in png_set_alpha will
+fire if more than one call to png_set_alpha_mode and png_set_background is
+made in the same read operation, however multiple calls with PNG_ALPHA_PNG
+are ignored.
+
If you don't need, or can't handle, the alpha channel you can call
png_set_background() to remove it by compositing against a fixed color. Don't
call png_set_strip_alpha() to do this - it will leave spurious pixel values in
@@ -1216,7 +1384,7 @@ png_set_rgb_to_gray()). png_get_sRGB(png_ptr, info_ptr, &srgb_intent);
- file_srgb_intent - the rendering intent (PNG_INFO_sRGB)
+ srgb_intent - the rendering intent (PNG_INFO_sRGB)
The presence of the sRGB chunk
means that the pixel data is in the
sRGB color space. This chunk also
@@ -2166,10 +2334,15 @@ how pngvalid.c does it. Finishing a sequential read
After you are finished reading the image through the
-low-level interface, you can finish reading the file. If you are
-interested in comments or time, which may be stored either before or
-after the image data, you should pass the separate png_info struct if
-you want to keep the comments from before and after the image
+low-level interface, you can finish reading the file.
+
+If you want to use a different crc action for handling CRC errors in
+chunks after the image data, you can call png_set_crc_action()
+again at this point.
+
+If you are interested in comments or time, which may be stored either
+before or after the image data, you should pass the separate png_info
+struct if you want to keep the comments from before and after the image
separate.
png_infop end_info = png_create_info_struct(png_ptr);
@@ -2185,6 +2358,9 @@ separate. If you are not interested, you should still call png_read_end()
but you can pass NULL, avoiding the need to create an end_info structure.
+If you do this, libpng will not process any chunks after IDAT other than
+skipping over them and perhaps (depending on whether you have called
+png_set_crc_action) checking their CRCs while looking for the IEND chunk.
png_read_end(png_ptr, (png_infop)NULL);
@@ -3535,7 +3711,7 @@ The simplified API, which became available in libpng-1.6.0, hides the details of both libpng and the PNG file format itself.
It allows PNG files to be read into a very limited number of
in-memory bitmap formats or to be written from the same formats. If these
-formats do not accomodate your needs then you can, and should, use the more
+formats do not accommodate your needs then you can, and should, use the more
sophisticated APIs above - these support a wide variety of in-memory formats
and a wide variety of sophisticated transformations to those formats as well
as a wide variety of APIs to manipulate ancilliary information.
@@ -4393,6 +4569,9 @@ png_set_error_fn(), which is essentially the same function, but with a new name to force compilation errors with applications that try to use the old
method.
+Support for the sCAL, iCCP, iTXt, and sPLT chunks was added at libpng-1.0.6;
+however, iTXt support was not enabled by default.
+
Starting with version 1.0.7, you can find out which version of the library
you are using at run-time:
@@ -4609,7 +4788,7 @@ it has not been well tested and doesn't actually "dither". The code was not
removed, however, and could be enabled by building libpng with
PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support
-was reenabled, but the function was renamed png_set_quantize() to
+was re-enabled, but the function was renamed png_set_quantize() to
reflect more accurately what it actually does. At the same time,
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS, and PNG_READ_DITHER_SUPPORTED
@@ -4621,12 +4800,13 @@ XI. Changes to Libpng from version 1.4.x to 1.5.x From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32.
+The incorrect macro was removed from libpng-1.4.5.
-Checking for invalid palette index on read or write was added at libpng
-1.5.10. When an invalid index is found, libpng issues a benign error.
-This is enabled by default because this condition is an error according
-to the PNG specification, Clause 11.3.2, but the error can be ignored in
-each png_ptr with
+Checking for invalid palette index on write was added at libpng
+1.5.10. If a pixel contains an invalid (out-of-range) index libpng issues
+a benign error. This is enabled by default because this condition is an
+error according to the PNG specification, Clause 11.3.2, but the error can
+be ignored in each png_ptr with
png_set_check_for_invalid_index(png_ptr, allowed);
@@ -4725,7 +4905,10 @@ and the accuracy of PNG fixed point values is insufficient for representation of these values. Consequently a "string" API
(png_get_sCAL_s and png_set_sCAL_s) is the only reliable way of reading
arbitrary sCAL chunks in the absence of either the floating point API or
-internal floating point calculations.
+internal floating point calculations. Starting with libpng-1.5.0, both
+of these functions are present when PNG_sCAL_SUPPORTED is defined. Prior
+to libpng-1.5.0, their presence also depended upon PNG_FIXED_POINT_SUPPORTED
+being defined and PNG_FLOATING_POINT_SUPPORTED not being defined.
Applications no longer need to include the optional distribution header
file pngusr.h or define the corresponding macros during application
@@ -4745,15 +4928,10 @@ reset by pngusr.h or by explicit settings on the compiler command line. These settings may produce compiler warnings or errors in 1.5.0 because
of macro redefinition.
-From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
-function) incorrectly returned a value of type png_uint_32. libpng 1.5.0
-is consistent with the implementation in 1.4.5 and 1.2.x (where the macro
-did not exist.)
-
Applications can now choose whether to use these macros or to call the
corresponding function by defining PNG_USE_READ_MACROS or
PNG_NO_USE_READ_MACROS before including png.h. Notice that this is
-only supported from 1.5.0 -defining PNG_NO_USE_READ_MACROS prior to 1.5.0
+only supported from 1.5.0; defining PNG_NO_USE_READ_MACROS prior to 1.5.0
will lead to a link failure.
Prior to libpng-1.5.4, the zlib compressor used the same set of parameters
@@ -4767,7 +4945,10 @@ option was off by default, and slightly inaccurate scaling occurred. This option can no longer be turned off, and the choice of accurate
or inaccurate 16-to-8 scaling is by using the new png_set_scale_16_to_8()
API for accurate scaling or the old png_set_strip_16_to_8() API for simple
-chopping.
+chopping. In libpng-1.5.4, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
+macro became PNG_READ_SCALE_16_TO_8_SUPPORTED, and the PNG_READ_16_TO_8
+macro became PNG_READ_STRIP_16_TO_8_SUPPORTED, to enable the two
+png_set_*_16_to_8() functions separately.
Prior to libpng-1.5.4, the png_set_user_limits() function could only be
used to reduce the width and height limits from the value of
@@ -4789,6 +4970,9 @@ limits are now png_user_chunk_cache_max 0 (unlimited) 128
png_user_chunk_malloc_max 0 (unlimited) 8,000,000
+The png_set_option() function (and the "options" member of the png struct) was
+added to libpng-1.5.15.
+
B. Changes to the build and configuration of libpng
Details of internal changes to the library code can be found in the CHANGES
@@ -4933,7 +5117,7 @@ pngconf.h no longer includes pngusr.h, therefore pngusr.h is ignored after the build of pnglibconf.h and it is never included in an application build.
The rarely used alternative of adding a list of feature macros to the
-CFLAGS setting in the build also still works; however, the macros will be
+CPPFLAGS setting in the build also still works; however, the macros will be
copied to pnglibconf.h and this may produce macro redefinition warnings
when the individual C files are compiled.
@@ -4990,7 +5174,6 @@ The following API are now DEPRECATED: png_info_init_3()
png_convert_to_rfc1123() which has been replaced
with png_convert_to_rfc1123_buffer()
- png_data_freer()
png_malloc_default()
png_free_default()
png_reset_zstream()
@@ -5012,10 +5195,11 @@ where "rp" indicates a "restricted pointer". Error detection in some chunks has improved; in particular the iCCP chunk
reader now does pretty complete validation of the basic format. Some bad
-profiles that were previously accepted are now rejected, in particular the
-very old broken Microsoft/HP sRGB profile. The PNG spec requirement that
-only grayscale profiles may appear in images with color type 0 or 4 and that
-even if the image only contains gray pixels, only RGB profiles may appear
+profiles that were previously accepted are now accepted with a warning or
+rejected, depending upon the png_set_benign_errors() setting, in particular the
+very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement
+that only grayscale profiles may appear in images with color type 0 or 4 and
+that even if the image only contains gray pixels, only RGB profiles may appear
in images with color type 2, 3, or 6, is now enforced. The sRGB chunk
is allowed to appear in images with any color type.
@@ -5024,7 +5208,9 @@ an empty language field or an empty translated keyword. Both of these are allowed by the PNG specification, so these warnings are no longer issued.
The library now issues an error if the application attempts to set a
-transform after it calls png_read_update_info().
+transform after it calls png_read_update_info() or if it attempts to call
+both png_read_update_info() and png_start_read_image() or to call either
+of them more than once.
The default condition for benign_errors is now to treat benign errors as
warnings while reading and as errors while writing.
@@ -5045,14 +5231,19 @@ The machine-generated configure files are no longer included in branches libpng16 and later of the GIT repository. They continue to be included
in the tarball releases, however.
-Libpng-1.6.0 and later use the CMF bytes at the beginning of the IDAT stream
-to set the size of the sliding window for reading instead of using the default
-32-kbyte sliding window size. It was discovered that there are hundreds of PNG
-files in the wild that have incorrect CMF bytes that cause libpng to now issue
-a "too far back" error and reject the file. Libpng-1.6.3 provides a way to
-revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
-32-kbyte sliding window), and provides a tool
-(contrib/tools/png-fix-too-far-back) for optimizing the CMF bytes
+Libpng-1.6.0 through 1.6.2 used the CMF bytes at the beginning of the IDAT
+stream to set the size of the sliding window for reading instead of using the
+default 32-kbyte sliding window size. It was discovered that there are
+hundreds of PNG files in the wild that have incorrect CMF bytes that caused
+libpng to issue a "too far back" error and reject the file. Libpng-1.6.3 and
+later calculate their own safe CMF from the image dimensions, provide a way
+to revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
+32-kbyte sliding window), by using
+
+ png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW,
+ PNG_OPTION_ON);
+
+and provide a tool (contrib/tools/pngfix) for optimizing the CMF bytes
correctly.
Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong
@@ -5158,6 +5349,9 @@ exported functions are marked with PNGAPI: body;
}
+The return type and decorations are placed on a separate line
+ahead of the function name, as illustrated above.
+
The prototypes for all exported functions appear in png.h,
above the comment that says
@@ -5222,13 +5416,13 @@ Other rules can be inferred by inspecting the libpng source. XVI. Y2K Compliance in libpng
-July 18, 2013
+March 6, 2014
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.3 are Y2K compliant. It is my belief that earlier
+upward through 1.6.10 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
diff --git a/plugins/AdvaImg/src/LibPNG/libpng.3 b/plugins/AdvaImg/src/LibPNG/libpng.3 index 7f2f4cff20..a84c3b6b7e 100644 --- a/plugins/AdvaImg/src/LibPNG/libpng.3 +++ b/plugins/AdvaImg/src/LibPNG/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "July 18, 2013"
+.TH LIBPNG 3 "March 6, 2014"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.3
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.10
.SH SYNOPSIS
\fB
#include <png.h>\fP
@@ -504,10 +504,10 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng
- libpng version 1.6.3 - July 18, 2013
+ libpng version 1.6.10 - March 6, 2014
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
- Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ Copyright (c) 1998-2014 Glenn Randers-Pehrson
This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer
@@ -515,9 +515,9 @@ libpng-manual.txt - A description on how to use and modify libpng Based on:
- libpng versions 0.97, January 1998, through 1.6.3 - July 18, 2013
+ libpng versions 0.97, January 1998, through 1.6.10 - March 6, 2014
Updated and distributed by Glenn Randers-Pehrson
- Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ Copyright (c) 1998-2014 Glenn Randers-Pehrson
libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger
@@ -672,7 +672,7 @@ All APIs that take (double) arguments also have a matching API that takes the corresponding fixed point integer arguments. The fixed point
API has the same name as the floating point one with "_fixed" appended.
The actual range of values permitted in the APIs is frequently less than
-the full range of (png_fixed_point) (-21474 to +21474). When APIs require
+the full range of (png_fixed_point) (\-21474 to +21474). When APIs require
a non-negative argument the type is recorded as png_uint_32 above. Consult
the header file and the text below for more information.
@@ -713,7 +713,7 @@ The easiest way to make minor changes to the libpng configuration when auto-configuration is supported is to add definitions to the command line
using (typically) CPPFLAGS. For example:
-CPPFLAGS=-DPNG_NO_FLOATING_ARITHMETIC
+CPPFLAGS=\-DPNG_NO_FLOATING_ARITHMETIC
will change the internal libpng math implementation for gamma correction and
other arithmetic calculations to fixed point, avoiding the need for fast
@@ -721,7 +721,7 @@ floating point support. The result can be seen in the generated pnglibconf.h - make sure it contains the changed feature macro setting.
If you need to make more extensive configuration changes - more than one or two
-feature macro settings - you can either add -DPNG_USER_CONFIG to the build
+feature macro settings - you can either add \-DPNG_USER_CONFIG to the build
command line and put a list of feature macro settings in pngusr.h or you can set
DFA_XTRA (a makefile variable) to a file containing the same information in the
form of 'option' settings.
@@ -778,10 +778,10 @@ This method of building a customized pnglibconf.h is illustrated in contrib/pngminim/*. See the "$(PNGCONF):" target in the makefile and
pngusr.dfa in these directories.
-C. Configuration using PNG_USR_CONFIG
+C. Configuration using PNG_USER_CONFIG
-If -DPNG_USR_CONFIG is added to the CFLAGS when pnglibconf.h is built the file
-pngusr.h will automatically be included before the options in
+If \-DPNG_USER_CONFIG is added to the CPPFLAGS when pnglibconf.h is built,
+the file pngusr.h will automatically be included before the options in
scripts/pnglibconf.dfa are processed. Your pngusr.h file should contain only
macro definitions turning features on or off or setting settings.
@@ -1010,7 +1010,7 @@ input stream. You must supply the function unknown chunk structure, process it, and return one
of the following: */
- return (-n); /* chunk had an error */
+ return (\-n); /* chunk had an error */
return (0); /* did not recognize */
return (n); /* success */
}
@@ -1061,7 +1061,7 @@ non-interlaced case the row that was just handled is simply one less than the passed in row number, and pass will always be 0. For the interlaced case the
same applies unless the row value is 0, in which case the row just handled was
the last one from one of the preceding passes. Because interlacing may skip a
-pass you cannot be sure that the preceding pass is just 'pass-1', if you really
+pass you cannot be sure that the preceding pass is just 'pass\-1', if you really
need to know what the last pass is record (row,pass) from the callback and use
the last recorded value each time.
@@ -1151,7 +1151,7 @@ callback function: .SS User limits
The PNG specification allows the width and height of an image to be as
-large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
+large as 2^(31\-1 (0x7fffffff), or about 2.147 billion rows and columns.
Since very few applications really need to process such large images,
we have imposed an arbitrary 1-million limit on rows and columns.
Larger images will be rejected immediately with a png_error() call. If
@@ -1216,12 +1216,12 @@ value. You can also specify a default encoding for the PNG file in case the required information is missing from the file. By default libpng
assumes that the PNG data matches your system, to keep this default call:
- png_set_gamma(png_ptr, screen_gamma, 1/screen_gamma/*file gamma*/);
+ png_set_gamma(png_ptr, screen_gamma, output_gamma);
or you can use the fixed point equivalent:
png_set_gamma_fixed(png_ptr, PNG_FP_1*screen_gamma,
- PNG_FP_1/screen_gamma);
+ PNG_FP_1*output_gamma);
If you don't know the gamma for your system it is probably 2.2 - a good
approximation to the IEC standard for display systems (sRGB). If images are
@@ -1244,11 +1244,75 @@ situations: encoding.
You would use the linear (unencoded) value if you need to process the pixel
-values further because this avoids the need to decode and reencode each
+values further because this avoids the need to decode and re-encode each
component value whenever arithmetic is performed. A lot of graphics software
uses linear values for this reason, often with higher precision component values
to preserve overall accuracy.
+
+The output_gamma value expresses how to decode the output values, not how
+they are encoded. The values used correspond to the normal numbers used to
+describe the overall gamma of a computer display system; for example 2.2 for
+an sRGB conformant system. The values are scaled by 100000 in the _fixed
+version of the API (so 220000 for sRGB.)
+
+The inverse of the value is always used to provide a default for the PNG file
+encoding if it has no gAMA chunk and if png_set_gamma() has not been called
+to override the PNG gamma information.
+
+When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode
+opaque pixels however pixels with lower alpha values are not encoded,
+regardless of the output gamma setting.
+
+When the standard Porter Duff handling is requested with mode 1 the output
+encoding is set to be linear and the output_gamma value is only relevant
+as a default for input data that has no gamma information. The linear output
+encoding will be overridden if png_set_gamma() is called - the results may be
+highly unexpected!
+
+The following numbers are derived from the sRGB standard and the research
+behind it. sRGB is defined to be approximated by a PNG gAMA chunk value of
+0.45455 (1/2.2) for PNG. The value implicitly includes any viewing
+correction required to take account of any differences in the color
+environment of the original scene and the intended display environment; the
+value expresses how to *decode* the image for display, not how the original
+data was *encoded*.
+
+sRGB provides a peg for the PNG standard by defining a viewing environment.
+sRGB itself, and earlier TV standards, actually use a more complex transform
+(a linear portion then a gamma 2.4 power law) than PNG can express. (PNG is
+limited to simple power laws.) By saying that an image for direct display on
+an sRGB conformant system should be stored with a gAMA chunk value of 45455
+(11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification
+makes it possible to derive values for other display systems and
+environments.
+
+The Mac value is deduced from the sRGB based on an assumption that the actual
+extra viewing correction used in early Mac display systems was implemented as
+a power 1.45 lookup table.
+
+Any system where a programmable lookup table is used or where the behavior of
+the final display device characteristics can be changed requires system
+specific code to obtain the current characteristic. However this can be
+difficult and most PNG gamma correction only requires an approximate value.
+
+By default, if png_set_alpha_mode() is not called, libpng assumes that all
+values are unencoded, linear, values and that the output device also has a
+linear characteristic. This is only very rarely correct - it is invariably
+better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the
+default if you don't know what the right answer is!
+
+The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS
+10.6) which used a correction table to implement a somewhat lower gamma on an
+otherwise sRGB system.
+
+Both these values are reserved (not simple gamma values) in order to allow
+more precise correction internally in the future.
+
+NOTE: the values can be passed to either the fixed or floating
+point APIs, but the floating point API will also accept floating point
+values.
+
The second thing you may need to tell libpng about is how your system handles
alpha channel information. Some, but not all, PNG files contain an alpha
channel. To display these files correctly you need to compose the data onto a
@@ -1273,11 +1337,11 @@ by png_set_alpha_mode(). The mode is as follows:
- PNG_ALPHA_PNG: The data is encoded according to the PNG specification. Red,
-green and blue, or gray, components are gamma encoded color
-values and are not premultiplied by the alpha value. The
-alpha value is a linear measure of the contribution of the
-pixel to the corresponding final output pixel.
+ PNG_ALPHA_PNG: The data is encoded according to the PNG
+specification. Red, green and blue, or gray, components are
+gamma encoded color values and are not premultiplied by the
+alpha value. The alpha value is a linear measure of the
+contribution of the pixel to the corresponding final output pixel.
You should normally use this format if you intend to perform
color correction on the color values; most, maybe all, color
@@ -1294,11 +1358,35 @@ be used! The remaining modes assume you don't need to do any further color correction or
that if you do, your color correction software knows all about alpha (it
-probably doesn't!)
-
- PNG_ALPHA_STANDARD: The data libpng produces
-is encoded in the standard way
-assumed by most correctly written graphics software.
+probably doesn't!). They 'associate' the alpha with the color information by
+storing color channel values that have been scaled by the alpha. The
+advantage is that the color channels can be resampled (the image can be
+scaled) in this form. The disadvantage is that normal practice is to store
+linear, not (gamma) encoded, values and this requires 16-bit channels for
+still images rather than the 8-bit channels that are just about sufficient if
+gamma encoding is used. In addition all non-transparent pixel values,
+including completely opaque ones, must be gamma encoded to produce the final
+image. These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes
+described below (the latter being the two common names for associated alpha
+color channels). Note that PNG files always contain non-associated color
+channels; png_set_alpha_mode() with one of the modes causes the decoder to
+convert the pixels to an associated form before returning them to your
+application.
+
+Since it is not necessary to perform arithmetic on opaque color values so
+long as they are not to be resampled and are in the final color space it is
+possible to optimize the handling of alpha by storing the opaque pixels in
+the PNG format (adjusted for the output color space) while storing partially
+opaque pixels in the standard, linear, format. The accuracy required for
+standard alpha composition is relatively low, because the pixels are
+isolated, therefore typically the accuracy loss in storing 8-bit linear
+values is acceptable. (This is not true if the alpha channel is used to
+simulate transparency over large areas - use 16 bits or the PNG mode in
+this case!) This is the 'OPTIMIZED' mode. For this mode a pixel is
+treated as opaque only if the alpha value is equal to the maximum value.
+
+ PNG_ALPHA_STANDARD: The data libpng produces is encoded in the
+standard way assumed by most correctly written graphics software.
The gamma encoding will be removed by libpng and the
linear component values will be pre-multiplied by the
alpha channel.
@@ -1327,9 +1415,8 @@ dynamic range. To avoid problems, and if your software supports it, use png_set_expand_16() to force all
components to 16 bits.
- PNG_ALPHA_OPTIMIZED: This mode is the same
-as PNG_ALPHA_STANDARD except that
-completely opaque pixels are gamma encoded according to
+ PNG_ALPHA_OPTIMIZED: This mode is the same as PNG_ALPHA_STANDARD
+except that completely opaque pixels are gamma encoded according to
the screen_gamma value. Pixels with alpha less than 1.0
will still have linear components.
@@ -1348,18 +1435,16 @@ representation of non-opaque pixels are irrelevant. You can also try this format if your software is broken;
it might look better.
- PNG_ALPHA_BROKEN: This is PNG_ALPHA_STANDARD;
-however, all component values,
-including the alpha channel are gamma encoded. This is
-an appropriate format to try if your software, or more
-likely hardware, is totally broken, i.e., if it performs
-linear arithmetic directly on gamma encoded values.
-
-In most cases of broken software or hardware the bug in the final display
-manifests as a subtle halo around composited parts of the image. You may not
-even perceive this as a halo; the composited part of the image may simply appear
-separate from the background, as though it had been cut out of paper and pasted
-on afterward.
+ PNG_ALPHA_BROKEN: This is PNG_ALPHA_STANDARD; however, all component
+values, including the alpha channel are gamma encoded. This is
+broken because, in practice, no implementation that uses this choice
+correctly undoes the encoding before handling alpha composition. Use this
+choice only if other serious errors in the software or hardware you use
+mandate it. In most cases of broken software or hardware the bug in the
+final display manifests as a subtle halo around composited parts of the
+image. You may not even perceive this as a halo; the composited part of
+the image may simply appear separate from the background, as though it had
+been cut out of paper and pasted on afterward.
If you don't have to deal with bugs in software or hardware, or if you can fix
them, there are three recommended ways of using png_set_alpha_mode():
@@ -1390,6 +1475,89 @@ All you can do is compose the result onto a matching output. Since this mode is libpng-specific you also need to write your own composition
software.
+The following are examples of calls to png_set_alpha_mode to achieve the
+required overall gamma correction and, where necessary, alpha
+premultiplication.
+
+ png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
+
+This is the default libpng handling of the alpha channel - it is not
+pre-multiplied into the color components. In addition the call states
+that the output is for a sRGB system and causes all PNG files without gAMA
+chunks to be assumed to be encoded using sRGB.
+
+ png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
+
+In this case the output is assumed to be something like an sRGB conformant
+display preceeded by a power-law lookup table of power 1.45. This is how
+early Mac systems behaved.
+
+ png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
+
+This is the classic Jim Blinn approach and will work in academic
+environments where everything is done by the book. It has the shortcoming
+of assuming that input PNG data with no gamma information is linear - this
+is unlikely to be correct unless the PNG files where generated locally.
+Most of the time the output precision will be so low as to show
+significant banding in dark areas of the image.
+
+ png_set_expand_16(pp);
+ png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_DEFAULT_sRGB);
+
+This is a somewhat more realistic Jim Blinn inspired approach. PNG files
+are assumed to have the sRGB encoding if not marked with a gamma value and
+the output is always 16 bits per component. This permits accurate scaling
+and processing of the data. If you know that your input PNG files were
+generated locally you might need to replace PNG_DEFAULT_sRGB with the
+correct value for your system.
+
+ png_set_alpha_mode(pp, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB);
+
+If you just need to composite the PNG image onto an existing background
+and if you control the code that does this you can use the optimization
+setting. In this case you just copy completely opaque pixels to the
+output. For pixels that are not completely transparent (you just skip
+those) you do the composition math using png_composite or png_composite_16
+below then encode the resultant 8-bit or 16-bit values to match the output
+encoding.
+
+ Other cases
+
+If neither the PNG nor the standard linear encoding work for you because
+of the software or hardware you use then you have a big problem. The PNG
+case will probably result in halos around the image. The linear encoding
+will probably result in a washed out, too bright, image (it's actually too
+contrasty.) Try the ALPHA_OPTIMIZED mode above - this will probably
+substantially reduce the halos. Alternatively try:
+
+ png_set_alpha_mode(pp, PNG_ALPHA_BROKEN, PNG_DEFAULT_sRGB);
+
+This option will also reduce the halos, but there will be slight dark
+halos round the opaque parts of the image where the background is light.
+In the OPTIMIZED mode the halos will be light halos where the background
+is dark. Take your pick - the halos are unavoidable unless you can get
+your hardware/software fixed! (The OPTIMIZED approach is slightly
+faster.)
+
+When the default gamma of PNG files doesn't match the output gamma.
+If you have PNG files with no gamma information png_set_alpha_mode allows
+you to provide a default gamma, but it also sets the ouput gamma to the
+matching value. If you know your PNG files have a gamma that doesn't
+match the output you can take advantage of the fact that
+png_set_alpha_mode always sets the output gamma but only sets the PNG
+default if it is not already set:
+
+ png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
+ png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
+
+The first call sets both the default and the output gamma values, the
+second call overrides the output gamma without changing the default. This
+is easier than achieving the same effect with png_set_gamma. You must use
+PNG_ALPHA_PNG for the first call - internal checking in png_set_alpha will
+fire if more than one call to png_set_alpha_mode and png_set_background is
+made in the same read operation, however multiple calls with PNG_ALPHA_PNG
+are ignored.
+
If you don't need, or can't handle, the alpha channel you can call
png_set_background() to remove it by compositing against a fixed color. Don't
call png_set_strip_alpha() to do this - it will leave spurious pixel values in
@@ -1720,7 +1888,7 @@ png_set_rgb_to_gray()). png_get_sRGB(png_ptr, info_ptr, &srgb_intent);
- file_srgb_intent - the rendering intent (PNG_INFO_sRGB)
+ srgb_intent - the rendering intent (PNG_INFO_sRGB)
The presence of the sRGB chunk
means that the pixel data is in the
sRGB color space. This chunk also
@@ -2670,10 +2838,15 @@ how pngvalid.c does it. .SS Finishing a sequential read
After you are finished reading the image through the
-low-level interface, you can finish reading the file. If you are
-interested in comments or time, which may be stored either before or
-after the image data, you should pass the separate png_info struct if
-you want to keep the comments from before and after the image
+low-level interface, you can finish reading the file.
+
+If you want to use a different crc action for handling CRC errors in
+chunks after the image data, you can call png_set_crc_action()
+again at this point.
+
+If you are interested in comments or time, which may be stored either
+before or after the image data, you should pass the separate png_info
+struct if you want to keep the comments from before and after the image
separate.
png_infop end_info = png_create_info_struct(png_ptr);
@@ -2689,6 +2862,9 @@ separate. If you are not interested, you should still call png_read_end()
but you can pass NULL, avoiding the need to create an end_info structure.
+If you do this, libpng will not process any chunks after IDAT other than
+skipping over them and perhaps (depending on whether you have called
+png_set_crc_action) checking their CRCs while looking for the IEND chunk.
png_read_end(png_ptr, (png_infop)NULL);
@@ -2723,13 +2899,13 @@ point to libpng-allocated storage with the following function: or simply PNG_FREE_ALL
seq - sequence number of item to be freed
- (-1 for all items)
+ (\-1 for all items)
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
by the user and not by libpng, and will in those cases do nothing.
The "seq" parameter is ignored if only one item of the selected data
-type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
+type, such as PLTE, is allowed. If "seq" is not \-1, and multiple items
are allowed for the data type identified in the mask, such as text or
sPLT, only the n'th item in the structure is freed, where n is "seq".
@@ -3130,7 +3306,7 @@ non-interlaced case the row that was just handled is simply one less than the passed in row number, and pass will always be 0. For the interlaced case the
same applies unless the row value is 0, in which case the row just handled was
the last one from one of the preceding passes. Because interlacing may skip a
-pass you cannot be sure that the preceding pass is just 'pass-1', if you really
+pass you cannot be sure that the preceding pass is just 'pass\-1', if you really
need to know what the last pass is record (row,pass) from the callback and use
the last recorded value each time.
@@ -3970,13 +4146,13 @@ point to libpng-allocated storage with the following function: or simply PNG_FREE_ALL
seq - sequence number of item to be freed
- (-1 for all items)
+ (\-1 for all items)
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
by the user and not by libpng, and will in those cases do nothing.
The "seq" parameter is ignored if only one item of the selected data
-type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
+type, such as PLTE, is allowed. If "seq" is not \-1, and multiple items
are allowed for the data type identified in the mask, such as text or
sPLT, only the n'th item in the structure is freed, where n is "seq".
@@ -4039,7 +4215,7 @@ The simplified API, which became available in libpng-1.6.0, hides the details of both libpng and the PNG file format itself.
It allows PNG files to be read into a very limited number of
in-memory bitmap formats or to be written from the same formats. If these
-formats do not accomodate your needs then you can, and should, use the more
+formats do not accommodate your needs then you can, and should, use the more
sophisticated APIs above - these support a wide variety of in-memory formats
and a wide variety of sophisticated transformations to those formats as well
as a wide variety of APIs to manipulate ancilliary information.
@@ -4829,7 +5005,7 @@ this version of libpng, but if you insert some they will be printed. Starting with libpng-1.6.0, you can configure libpng (when using the
"configure" script) to prefix all exported symbols by means of the
-configuration option "--with-libpng-prefix=FOO_", where FOO_ can be any
+configuration option "\-\-with\-libpng\-prefix=FOO_", where FOO_ can be any
string beginning with a letter and containing only uppercase
and lowercase letters, digits, and the underscore (i.e., a C language
identifier). This creates a set of macros in pnglibconf.h, so this is
@@ -4898,6 +5074,9 @@ png_set_error_fn(), which is essentially the same function, but with a new name to force compilation errors with applications that try to use the old
method.
+Support for the sCAL, iCCP, iTXt, and sPLT chunks was added at libpng-1.0.6;
+however, iTXt support was not enabled by default.
+
Starting with version 1.0.7, you can find out which version of the library
you are using at run-time:
@@ -5114,7 +5293,7 @@ it has not been well tested and doesn't actually "dither". The code was not
removed, however, and could be enabled by building libpng with
PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support
-was reenabled, but the function was renamed png_set_quantize() to
+was re-enabled, but the function was renamed png_set_quantize() to
reflect more accurately what it actually does. At the same time,
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS, and PNG_READ_DITHER_SUPPORTED
@@ -5126,12 +5305,13 @@ We removed the trailing '.' from the warning and error messages. From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32.
+The incorrect macro was removed from libpng-1.4.5.
-Checking for invalid palette index on read or write was added at libpng
-1.5.10. When an invalid index is found, libpng issues a benign error.
-This is enabled by default because this condition is an error according
-to the PNG specification, Clause 11.3.2, but the error can be ignored in
-each png_ptr with
+Checking for invalid palette index on write was added at libpng
+1.5.10. If a pixel contains an invalid (out-of-range) index libpng issues
+a benign error. This is enabled by default because this condition is an
+error according to the PNG specification, Clause 11.3.2, but the error can
+be ignored in each png_ptr with
png_set_check_for_invalid_index(png_ptr, allowed);
@@ -5152,7 +5332,7 @@ reading, and after png_write_png() or png_write_image() while writing. int max_palette = png_get_palette_max(png_ptr, info_ptr);
-This will return the maximum palette index found in the image, or "-1" if
+This will return the maximum palette index found in the image, or "\-1" if
the palette was not checked, or "0" if no palette was found. Note that this
does not account for any palette index used by ancillary chunks such as the
bKGD chunk; you must check those separately to determine the maximum
@@ -5230,7 +5410,10 @@ and the accuracy of PNG fixed point values is insufficient for representation of these values. Consequently a "string" API
(png_get_sCAL_s and png_set_sCAL_s) is the only reliable way of reading
arbitrary sCAL chunks in the absence of either the floating point API or
-internal floating point calculations.
+internal floating point calculations. Starting with libpng-1.5.0, both
+of these functions are present when PNG_sCAL_SUPPORTED is defined. Prior
+to libpng-1.5.0, their presence also depended upon PNG_FIXED_POINT_SUPPORTED
+being defined and PNG_FLOATING_POINT_SUPPORTED not being defined.
Applications no longer need to include the optional distribution header
file pngusr.h or define the corresponding macros during application
@@ -5250,15 +5433,10 @@ reset by pngusr.h or by explicit settings on the compiler command line. These settings may produce compiler warnings or errors in 1.5.0 because
of macro redefinition.
-From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
-function) incorrectly returned a value of type png_uint_32. libpng 1.5.0
-is consistent with the implementation in 1.4.5 and 1.2.x (where the macro
-did not exist.)
-
Applications can now choose whether to use these macros or to call the
corresponding function by defining PNG_USE_READ_MACROS or
PNG_NO_USE_READ_MACROS before including png.h. Notice that this is
-only supported from 1.5.0 -defining PNG_NO_USE_READ_MACROS prior to 1.5.0
+only supported from 1.5.0; defining PNG_NO_USE_READ_MACROS prior to 1.5.0
will lead to a link failure.
Prior to libpng-1.5.4, the zlib compressor used the same set of parameters
@@ -5272,7 +5450,10 @@ option was off by default, and slightly inaccurate scaling occurred. This option can no longer be turned off, and the choice of accurate
or inaccurate 16-to-8 scaling is by using the new png_set_scale_16_to_8()
API for accurate scaling or the old png_set_strip_16_to_8() API for simple
-chopping.
+chopping. In libpng-1.5.4, the PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
+macro became PNG_READ_SCALE_16_TO_8_SUPPORTED, and the PNG_READ_16_TO_8
+macro became PNG_READ_STRIP_16_TO_8_SUPPORTED, to enable the two
+png_set_*_16_to_8() functions separately.
Prior to libpng-1.5.4, the png_set_user_limits() function could only be
used to reduce the width and height limits from the value of
@@ -5294,6 +5475,9 @@ limits are now png_user_chunk_cache_max 0 (unlimited) 128
png_user_chunk_malloc_max 0 (unlimited) 8,000,000
+The png_set_option() function (and the "options" member of the png struct) was
+added to libpng-1.5.15.
+
B. Changes to the build and configuration of libpng
Details of internal changes to the library code can be found in the CHANGES
@@ -5438,7 +5622,7 @@ pngconf.h no longer includes pngusr.h, therefore pngusr.h is ignored after the build of pnglibconf.h and it is never included in an application build.
The rarely used alternative of adding a list of feature macros to the
-CFLAGS setting in the build also still works; however, the macros will be
+CPPFLAGS setting in the build also still works; however, the macros will be
copied to pnglibconf.h and this may produce macro redefinition warnings
when the individual C files are compiled.
@@ -5495,7 +5679,6 @@ The following API are now DEPRECATED: png_info_init_3()
png_convert_to_rfc1123() which has been replaced
with png_convert_to_rfc1123_buffer()
- png_data_freer()
png_malloc_default()
png_free_default()
png_reset_zstream()
@@ -5517,10 +5700,11 @@ where "rp" indicates a "restricted pointer". Error detection in some chunks has improved; in particular the iCCP chunk
reader now does pretty complete validation of the basic format. Some bad
-profiles that were previously accepted are now rejected, in particular the
-very old broken Microsoft/HP sRGB profile. The PNG spec requirement that
-only grayscale profiles may appear in images with color type 0 or 4 and that
-even if the image only contains gray pixels, only RGB profiles may appear
+profiles that were previously accepted are now accepted with a warning or
+rejected, depending upon the png_set_benign_errors() setting, in particular the
+very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement
+that only grayscale profiles may appear in images with color type 0 or 4 and
+that even if the image only contains gray pixels, only RGB profiles may appear
in images with color type 2, 3, or 6, is now enforced. The sRGB chunk
is allowed to appear in images with any color type.
@@ -5529,7 +5713,9 @@ an empty language field or an empty translated keyword. Both of these are allowed by the PNG specification, so these warnings are no longer issued.
The library now issues an error if the application attempts to set a
-transform after it calls png_read_update_info().
+transform after it calls png_read_update_info() or if it attempts to call
+both png_read_update_info() and png_start_read_image() or to call either
+of them more than once.
The default condition for benign_errors is now to treat benign errors as
warnings while reading and as errors while writing.
@@ -5550,14 +5736,19 @@ The machine-generated configure files are no longer included in branches libpng16 and later of the GIT repository. They continue to be included
in the tarball releases, however.
-Libpng-1.6.0 and later use the CMF bytes at the beginning of the IDAT stream
-to set the size of the sliding window for reading instead of using the default
-32-kbyte sliding window size. It was discovered that there are hundreds of PNG
-files in the wild that have incorrect CMF bytes that cause libpng to now issue
-a "too far back" error and reject the file. Libpng-1.6.3 provides a way to
-revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
-32-kbyte sliding window), and provides a tool
-(contrib/tools/png-fix-too-far-back) for optimizing the CMF bytes
+Libpng-1.6.0 through 1.6.2 used the CMF bytes at the beginning of the IDAT
+stream to set the size of the sliding window for reading instead of using the
+default 32-kbyte sliding window size. It was discovered that there are
+hundreds of PNG files in the wild that have incorrect CMF bytes that caused
+libpng to issue a "too far back" error and reject the file. Libpng-1.6.3 and
+later calculate their own safe CMF from the image dimensions, provide a way
+to revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
+32-kbyte sliding window), by using
+
+ png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW,
+ PNG_OPTION_ON);
+
+and provide a tool (contrib/tools/pngfix) for optimizing the CMF bytes
correctly.
Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong
@@ -5663,6 +5854,9 @@ exported functions are marked with PNGAPI: body;
}
+The return type and decorations are placed on a separate line
+ahead of the function name, as illustrated above.
+
The prototypes for all exported functions appear in png.h,
above the comment that says
@@ -5706,7 +5900,7 @@ C binary operator and after "for" or "while", and before being cast, nor do we put one between a function name and the
left parenthesis that follows it:
- for (i = 2; i > 0; --i)
+ for (i = 2; i > 0; \-\-i)
y[i] = a(x) + (int)b;
We prefer #ifdef and #ifndef to #if defined() and #if !defined()
@@ -5727,13 +5921,13 @@ Other rules can be inferred by inspecting the libpng source. .SH XVI. Y2K Compliance in libpng
-July 18, 2013
+March 6, 2014
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.3 are Y2K compliant. It is my belief that earlier
+upward through 1.6.10 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
@@ -5950,6 +6144,23 @@ the first widely used release: 1.6.3beta01-11 16 10603 16.so.16.3[.0]
1.6.3rc01 16 10603 16.so.16.3[.0]
1.6.3 16 10603 16.so.16.3[.0]
+ 1.6.4beta01-02 16 10604 16.so.16.4[.0]
+ 1.6.4rc01 16 10604 16.so.16.4[.0]
+ 1.6.4 16 10604 16.so.16.4[.0]
+ 1.6.5 16 10605 16.so.16.5[.0]
+ 1.6.6 16 10606 16.so.16.6[.0]
+ 1.6.7beta01-04 16 10607 16.so.16.7[.0]
+ 1.6.7rc01-02 16 10607 16.so.16.7[.0]
+ 1.6.7 16 10607 16.so.16.7[.0]
+ 1.6.8beta01-02 16 10608 16.so.16.8[.0]
+ 1.6.8rc01-02 16 10608 16.so.16.8[.0]
+ 1.6.8 16 10608 16.so.16.8[.0]
+ 1.6.9beta01-04 16 10609 16.so.16.9[.0]
+ 1.6.9rc01-02 16 10609 16.so.16.9[.0]
+ 1.6.9 16 10609 16.so.16.9[.0]
+ 1.6.10beta01-03 16 10610 16.so.16.10[.0]
+ 1.6.10rc01-04 16 10610 16.so.16.10[.0]
+ 1.6.10 16 10610 16.so.16.10[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -6006,7 +6217,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation.
-Libpng version 1.6.3 - July 18, 2013:
+Libpng version 1.6.10 - March 6, 2014:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -6029,7 +6240,7 @@ this sentence. This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.6.3, July 18, 2013, are
+libpng versions 1.2.6, August 15, 2004, through 1.6.10, March 6, 2014, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@@ -6128,7 +6339,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-July 18, 2013
+March 6, 2014
.\" end of man page
diff --git a/plugins/AdvaImg/src/LibPNG/libpngpf.3 b/plugins/AdvaImg/src/LibPNG/libpngpf.3 index 7b6e69f6dd..62caa67efa 100644 --- a/plugins/AdvaImg/src/LibPNG/libpngpf.3 +++ b/plugins/AdvaImg/src/LibPNG/libpngpf.3 @@ -1,6 +1,6 @@ -.TH LIBPNGPF 3 "July 18, 2013"
+.TH LIBPNGPF 3 "March 6, 2014"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.3
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.10
(private functions)
.SH SYNOPSIS
\fB#include \fI"pngpriv.h"
diff --git a/plugins/AdvaImg/src/LibPNG/png.5 b/plugins/AdvaImg/src/LibPNG/png.5 index fbaee84e26..23e7c7f907 100644 --- a/plugins/AdvaImg/src/LibPNG/png.5 +++ b/plugins/AdvaImg/src/LibPNG/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "July 18, 2013"
+.TH PNG 5 "March 6, 2014"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
diff --git a/plugins/AdvaImg/src/LibPNG/png.c b/plugins/AdvaImg/src/LibPNG/png.c index 40db183bca..7a67bd3026 100644 --- a/plugins/AdvaImg/src/LibPNG/png.c +++ b/plugins/AdvaImg/src/LibPNG/png.c @@ -1,8 +1,8 @@ /* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.6.2 [April 25, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.9 [February 6, 2014]
+ * Copyright (c) 1998-2014 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,7 @@ #include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_3 Your_png_h_is_not_version_1_6_3;
+typedef png_libpng_version_1_6_10 Your_png_h_is_not_version_1_6_10;
/* 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
@@ -201,6 +201,7 @@ png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver) pos = png_safecat(m, (sizeof m), pos, user_png_ver);
pos = png_safecat(m, (sizeof m), pos, " but running with ");
pos = png_safecat(m, (sizeof m), pos, png_libpng_ver);
+ PNG_UNUSED(pos)
png_warning(png_ptr, m);
#endif
@@ -259,6 +260,10 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr, */
# ifdef PNG_USER_MEM_SUPPORTED
png_set_mem_fn(&create_struct, mem_ptr, malloc_fn, free_fn);
+# else
+ PNG_UNUSED(mem_ptr)
+ PNG_UNUSED(malloc_fn)
+ PNG_UNUSED(free_fn)
# endif
/* (*error_fn) can return control to the caller after the error_ptr is set,
@@ -768,14 +773,14 @@ png_get_copyright(png_const_structrp png_ptr) #else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
- "libpng version 1.6.3 - July 18, 2013" PNG_STRING_NEWLINE \
- "Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
+ "libpng version 1.6.10 - March 6, 2014" PNG_STRING_NEWLINE \
+ "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
- return "libpng version 1.6.3 - July 18, 2013\
- Copyright (c) 1998-2013 Glenn Randers-Pehrson\
+ return "libpng version 1.6.10 - March 6, 2014\
+ Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
# endif
@@ -821,6 +826,63 @@ png_get_header_version(png_const_structrp png_ptr) #endif
}
+#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
+/* NOTE: this routine is not used internally! */
+/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth
+ * large of png_color. This lets grayscale images be treated as
+ * paletted. Most useful for gamma correction and simplification
+ * of code. This API is not used internally.
+ */
+void PNGAPI
+png_build_grayscale_palette(int bit_depth, png_colorp palette)
+{
+ int num_palette;
+ int color_inc;
+ int i;
+ int v;
+
+ png_debug(1, "in png_do_build_grayscale_palette");
+
+ if (palette == NULL)
+ return;
+
+ switch (bit_depth)
+ {
+ case 1:
+ num_palette = 2;
+ color_inc = 0xff;
+ break;
+
+ case 2:
+ num_palette = 4;
+ color_inc = 0x55;
+ break;
+
+ case 4:
+ num_palette = 16;
+ color_inc = 0x11;
+ break;
+
+ case 8:
+ num_palette = 256;
+ color_inc = 1;
+ break;
+
+ default:
+ num_palette = 0;
+ color_inc = 0;
+ break;
+ }
+
+ for (i = 0, v = 0; i < num_palette; i++, v += color_inc)
+ {
+ palette[i].red = (png_byte)v;
+ palette[i].green = (png_byte)v;
+ palette[i].blue = (png_byte)v;
+ }
+}
+#endif
+
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
int PNGAPI
png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name)
@@ -855,7 +917,8 @@ png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name) return PNG_HANDLE_CHUNK_AS_DEFAULT;
}
-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
+ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
int /* PRIVATE */
png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name)
{
@@ -864,7 +927,7 @@ png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name) PNG_CSTRING_FROM_CHUNK(chunk_string, chunk_name);
return png_handle_as_unknown(png_ptr, chunk_string);
}
-#endif /* READ_UNKNOWN_CHUNKS */
+#endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
#endif /* SET_UNKNOWN_CHUNKS */
#ifdef PNG_READ_SUPPORTED
@@ -1679,7 +1742,8 @@ is_ICC_signature_char(png_alloc_size_t it) (it >= 97 && it <= 122);
}
-static int is_ICC_signature(png_alloc_size_t it)
+static int
+is_ICC_signature(png_alloc_size_t it)
{
return is_ICC_signature_char(it >> 24) /* checks all the top bits */ &&
is_ICC_signature_char((it >> 16) & 0xff) &&
@@ -1721,6 +1785,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace, # endif
/* The 'reason' is an arbitrary message, allow +79 maximum 195 */
pos = png_safecat(message, (sizeof message), pos, reason);
+ PNG_UNUSED(pos)
/* This is recoverable, but make it unconditionally an app_error on write to
* avoid writing invalid ICC profiles into PNG files. (I.e. we handle them
@@ -2231,15 +2296,16 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr, }
}
-# if PNG_sRGB_PROFILE_CHECKS > 0
- /* The signature matched, but the profile had been changed in some
- * way. This is an apparent violation of the ICC terms of use and,
- * anyway, probably indicates a data error or uninformed hacking.
- */
- if (png_sRGB_checks[i].have_md5)
- png_benign_error(png_ptr,
- "copyright violation: edited ICC profile ignored");
-# endif
+# if PNG_sRGB_PROFILE_CHECKS > 0
+ /* The signature matched, but the profile had been changed in some
+ * way. This probably indicates a data error or uninformed hacking.
+ * Fall through to "no match".
+ */
+ png_chunk_report(png_ptr,
+ "Not recognizing known sRGB profile that has been edited",
+ PNG_CHUNK_WARNING);
+ break;
+# endif
}
}
@@ -2409,14 +2475,6 @@ png_check_IHDR(png_const_structrp png_ptr, error = 1;
}
- if (width > (PNG_UINT_32_MAX
- >> 3) /* 8-byte RGBA pixels */
- - 48 /* bigrowbuf hack */
- - 1 /* filter byte */
- - 7*8 /* rounding of width to multiple of 8 pixels */
- - 8) /* extra max_pixel_depth pad */
- png_warning(png_ptr, "Width is too large for libpng to process pixels");
-
/* Check other values */
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
bit_depth != 8 && bit_depth != 16)
@@ -3090,11 +3148,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text) if (r > 2147483647. || r < -2147483648.)
png_fixed_error(png_ptr, text);
+# ifndef PNG_ERROR_TEXT_SUPPORTED
+ PNG_UNUSED(text)
+# endif
+
return (png_fixed_point)r;
}
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED) || \
+#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_COLORSPACE_SUPPORTED) ||\
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
/* muldiv functions */
/* This API takes signed arguments and rounds the result to the nearest
@@ -3267,27 +3329,29 @@ png_gamma_significant(png_fixed_point gamma_val) #endif
#ifdef PNG_READ_GAMMA_SUPPORTED
+# ifdef PNG_16BIT_SUPPORTED
/* A local convenience routine. */
static png_fixed_point
png_product2(png_fixed_point a, png_fixed_point b)
{
/* The required result is 1/a * 1/b; the following preserves accuracy. */
-#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
double r = a * 1E-5;
r *= b;
r = floor(r+.5);
if (r <= 2147483647. && r >= -2147483648.)
return (png_fixed_point)r;
-#else
+# else
png_fixed_point res;
if (png_muldiv(&res, a, b, 100000))
return res;
-#endif
+# endif
return 0; /* overflow */
}
+# endif /* 16BIT */
/* The inverse of the above. */
png_fixed_point
@@ -3592,6 +3656,7 @@ png_exp8bit(png_fixed_point lg2) return (png_byte)((x + 0x7fffffU) >> 24);
}
+#ifdef PNG_16BIT_SUPPORTED
static png_uint_16
png_exp16bit(png_fixed_point lg2)
{
@@ -3602,6 +3667,7 @@ png_exp16bit(png_fixed_point lg2) x -= x >> 16;
return (png_uint_16)((x + 32767U) >> 16);
}
+#endif /* 16BIT */
#endif /* FLOATING_ARITHMETIC */
png_byte
@@ -3627,6 +3693,7 @@ png_gamma_8bit_correct(unsigned int value, png_fixed_point gamma_val) return (png_byte)value;
}
+#ifdef PNG_16BIT_SUPPORTED
png_uint_16
png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma_val)
{
@@ -3649,6 +3716,7 @@ png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma_val) return (png_uint_16)value;
}
+#endif /* 16BIT */
/* This does the right thing based on the bit_depth field of the
* png_struct, interpreting values as 8-bit or 16-bit. While the result
@@ -3662,10 +3730,16 @@ png_gamma_correct(png_structrp png_ptr, unsigned int value, if (png_ptr->bit_depth == 8)
return png_gamma_8bit_correct(value, gamma_val);
+#ifdef PNG_16BIT_SUPPORTED
else
return png_gamma_16bit_correct(value, gamma_val);
+#else
+ /* should not reach this */
+ return 0;
+#endif /* 16BIT */
}
+#ifdef PNG_16BIT_SUPPORTED
/* Internal function to build a single 16-bit table - the table consists of
* 'num' 256 entry subtables, where 'num' is determined by 'shift' - the amount
* to shift the input values right (or 16-number_of_signifiant_bits).
@@ -3804,6 +3878,7 @@ png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable, last++;
}
}
+#endif /* 16BIT */
/* Build a single 8-bit table: same as the 16-bit case but much simpler (and
* typically much faster). Note that libpng currently does no sBIT processing
@@ -3832,6 +3907,7 @@ png_destroy_gamma_table(png_structrp png_ptr) png_free(png_ptr, png_ptr->gamma_table);
png_ptr->gamma_table = NULL;
+#ifdef PNG_16BIT_SUPPORTED
if (png_ptr->gamma_16_table != NULL)
{
int i;
@@ -3843,6 +3919,7 @@ png_destroy_gamma_table(png_structrp png_ptr) png_free(png_ptr, png_ptr->gamma_16_table);
png_ptr->gamma_16_table = NULL;
}
+#endif /* 16BIT */
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
@@ -3852,6 +3929,7 @@ png_destroy_gamma_table(png_structrp png_ptr) png_free(png_ptr, png_ptr->gamma_to_1);
png_ptr->gamma_to_1 = NULL;
+#ifdef PNG_16BIT_SUPPORTED
if (png_ptr->gamma_16_from_1 != NULL)
{
int i;
@@ -3874,6 +3952,7 @@ png_destroy_gamma_table(png_structrp png_ptr) png_free(png_ptr, png_ptr->gamma_16_to_1);
png_ptr->gamma_16_to_1 = NULL;
}
+#endif /* 16BIT */
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
}
@@ -3919,6 +3998,7 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth) }
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
}
+#ifdef PNG_16BIT_SUPPORTED
else
{
png_byte shift, sig_bit;
@@ -3975,24 +4055,20 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth) png_ptr->gamma_shift = shift;
-#ifdef PNG_16BIT_SUPPORTED
/* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now
* PNG_COMPOSE). This effectively smashed the background calculation for
* 16-bit output because the 8-bit table assumes the result will be reduced
* to 8 bits.
*/
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8))
-#endif
png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
png_ptr->screen_gamma > 0 ? png_product2(png_ptr->colorspace.gamma,
png_ptr->screen_gamma) : PNG_FP_1);
-#ifdef PNG_16BIT_SUPPORTED
else
png_build_16bit_table(png_ptr, &png_ptr->gamma_16_table, shift,
png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->colorspace.gamma,
png_ptr->screen_gamma) : PNG_FP_1);
-#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
@@ -4012,6 +4088,7 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth) }
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
}
+#endif /* 16BIT */
}
#endif /* READ_GAMMA */
diff --git a/plugins/AdvaImg/src/LibPNG/png.h b/plugins/AdvaImg/src/LibPNG/png.h index 9fafb2435a..77bffe6b40 100644 --- a/plugins/AdvaImg/src/LibPNG/png.h +++ b/plugins/AdvaImg/src/LibPNG/png.h @@ -1,8 +1,8 @@ /* png.h - header file for PNG reference library
*
- * libpng version 1.6.3 - July 18, 2013
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * libpng version 1.6.10 - March 6, 2014
+ * Copyright (c) 1998-2014 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.)
*
@@ -11,7 +11,7 @@ * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.6.3 - July 18, 2013: Glenn
+ * libpng versions 0.97, January 1998, through 1.6.10 - March 6, 2014: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -178,6 +178,23 @@ * 1.6.3beta01-11 16 10603 16.so.16.3[.0]
* 1.6.3rc01 16 10603 16.so.16.3[.0]
* 1.6.3 16 10603 16.so.16.3[.0]
+ * 1.6.4beta01-02 16 10604 16.so.16.4[.0]
+ * 1.6.4rc01 16 10604 16.so.16.4[.0]
+ * 1.6.4 16 10604 16.so.16.4[.0]
+ * 1.6.5 16 10605 16.so.16.5[.0]
+ * 1.6.6 16 10606 16.so.16.6[.0]
+ * 1.6.7beta01-04 16 10607 16.so.16.7[.0]
+ * 1.6.7rc01-03 16 10607 16.so.16.7[.0]
+ * 1.6.7 16 10607 16.so.16.7[.0]
+ * 1.6.8beta01-02 16 10608 16.so.16.8[.0]
+ * 1.6.8rc01-02 16 10608 16.so.16.8[.0]
+ * 1.6.8 16 10608 16.so.16.8[.0]
+ * 1.6.9beta01-04 16 10609 16.so.16.9[.0]
+ * 1.6.9rc01-02 16 10609 16.so.16.9[.0]
+ * 1.6.9 16 10609 16.so.16.9[.0]
+ * 1.6.10beta01-03 16 10610 16.so.16.10[.0]
+ * 1.6.10betarc01-04 16 10610 16.so.16.10[.0]
+ * 1.6.10beta 16 10610 16.so.16.10[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -209,7 +226,7 @@ *
* This code is released under the libpng license.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.6.3, July 18, 2013, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.6.10, March 6, 2014, are
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@@ -321,13 +338,13 @@ * Y2K compliance in libpng:
* =========================
*
- * July 18, 2013
+ * March 6, 2014
*
* 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.3 are Y2K compliant. It is my belief that
+ * upward through 1.6.10 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
@@ -387,9 +404,9 @@ */
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.3"
+#define PNG_LIBPNG_VER_STRING "1.6.10"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.6.3 - July 18, 2013\n"
+ " libpng version 1.6.10 - March 6, 2014\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@@ -397,7 +414,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 3
+#define PNG_LIBPNG_VER_RELEASE 10
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -428,7 +445,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 10603 /* 1.6.3 */
+#define PNG_LIBPNG_VER 10610 /* 1.6.10 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@@ -440,10 +457,6 @@ # include "pnglibconf.h"
#endif
-#define PNG_APNG_SUPPORTED
-#define PNG_READ_APNG_SUPPORTED
-#define PNG_WRITE_APNG_SUPPORTED
-
#ifndef PNG_VERSION_INFO_ONLY
/* Machine specific configuration. */
# include "pngconf.h"
@@ -534,21 +547,10 @@ extern "C" { * See pngconf.h for base types that vary by machine/system
*/
-#ifdef PNG_APNG_SUPPORTED
-/* dispose_op flags from inside fcTL */
-#define PNG_DISPOSE_OP_NONE 0x00
-#define PNG_DISPOSE_OP_BACKGROUND 0x01
-#define PNG_DISPOSE_OP_PREVIOUS 0x02
-
-/* blend_op flags from inside fcTL */
-#define PNG_BLEND_OP_SOURCE 0x00
-#define PNG_BLEND_OP_OVER 0x01
-#endif /* PNG_APNG_SUPPORTED */
-
/* 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_3;
+typedef char* png_libpng_version_1_6_10;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@@ -730,7 +732,8 @@ typedef png_time * png_timep; typedef const png_time * png_const_timep;
typedef png_time * * png_timepp;
-#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
+#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) ||\
+ defined(PNG_USER_CHUNKS_SUPPORTED)
/* png_unknown_chunk is a structure to hold queued chunks for which there is
* no specific support. The idea is that we can use this to queue
* up private chunks for output even though the library doesn't actually
@@ -864,10 +867,6 @@ typedef png_unknown_chunk * * png_unknown_chunkpp; #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
-#ifdef PNG_APNG_SUPPORTED
-#define PNG_INFO_acTL 0x10000
-#define PNG_INFO_fcTL 0x20000
-#endif
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
@@ -905,10 +904,6 @@ typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32, #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));
-#ifdef PNG_APNG_SUPPORTED
-typedef PNG_CALLBACK(void, *png_progressive_frame_ptr, (png_structp,
- png_uint_32));
-#endif
/* 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
@@ -1217,9 +1212,9 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, #endif
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
-/* How the alpha channel is interpreted - this affects how the color channels of
- * a PNG file are returned when an alpha channel, or tRNS chunk in a palette
- * file, is present.
+/* How the alpha channel is interpreted - this affects how the color channels
+ * of a PNG file are returned to the calling application when an alpha channel,
+ * or a tRNS chunk in a palette file, is present.
*
* This has no effect on the way pixels are written into a PNG output
* datastream. The color samples in a PNG datastream are never premultiplied
@@ -1227,33 +1222,19 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, *
* The default is to return data according to the PNG specification: the alpha
* channel is a linear measure of the contribution of the pixel to the
- * corresponding composited pixel. The gamma encoded color channels must be
- * scaled according to the contribution and to do this it is necessary to undo
+ * corresponding composited pixel, and the color channels are unassociated
+ * (not premultiplied). The gamma encoded color channels must be scaled
+ * according to the contribution and to do this it is necessary to undo
* the encoding, scale the color values, perform the composition and reencode
* the values. This is the 'PNG' mode.
*
* The alternative is to 'associate' the alpha with the color information by
- * storing color channel values that have been scaled by the alpha. The
- * advantage is that the color channels can be resampled (the image can be
- * scaled) in this form. The disadvantage is that normal practice is to store
- * linear, not (gamma) encoded, values and this requires 16-bit channels for
- * still images rather than the 8-bit channels that are just about sufficient if
- * gamma encoding is used. In addition all non-transparent pixel values,
- * including completely opaque ones, must be gamma encoded to produce the final
- * image. This is the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' mode (the
- * latter being the two common names for associated alpha color channels.)
- *
- * Since it is not necessary to perform arithmetic on opaque color values so
- * long as they are not to be resampled and are in the final color space it is
- * possible to optimize the handling of alpha by storing the opaque pixels in
- * the PNG format (adjusted for the output color space) while storing partially
- * opaque pixels in the standard, linear, format. The accuracy required for
- * standard alpha composition is relatively low, because the pixels are
- * isolated, therefore typically the accuracy loss in storing 8-bit linear
- * values is acceptable. (This is not true if the alpha channel is used to
- * simulate transparency over large areas - use 16 bits or the PNG mode in
- * this case!) This is the 'OPTIMIZED' mode. For this mode a pixel is
- * treated as opaque only if the alpha value is equal to the maximum value.
+ * storing color channel values that have been scaled by the alpha.
+ * image. These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes
+ * (the latter being the two common names for associated alpha color channels).
+ *
+ * For the 'OPTIMIZED' mode, a pixel is treated as opaque only if the alpha
+ * value is equal to the maximum value.
*
* The final choice is to gamma encode the alpha channel as well. This is
* broken because, in practice, no implementation that uses this choice
@@ -1280,68 +1261,7 @@ PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr, #if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
/* The output_gamma value is a screen gamma in libpng terminology: it expresses
- * how to decode the output values, not how they are encoded. The values used
- * correspond to the normal numbers used to describe the overall gamma of a
- * computer display system; for example 2.2 for an sRGB conformant system. The
- * values are scaled by 100000 in the _fixed version of the API (so 220000 for
- * sRGB.)
- *
- * The inverse of the value is always used to provide a default for the PNG file
- * encoding if it has no gAMA chunk and if png_set_gamma() has not been called
- * to override the PNG gamma information.
- *
- * When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode
- * opaque pixels however pixels with lower alpha values are not encoded,
- * regardless of the output gamma setting.
- *
- * When the standard Porter Duff handling is requested with mode 1 the output
- * encoding is set to be linear and the output_gamma value is only relevant
- * as a default for input data that has no gamma information. The linear output
- * encoding will be overridden if png_set_gamma() is called - the results may be
- * highly unexpected!
- *
- * The following numbers are derived from the sRGB standard and the research
- * behind it. sRGB is defined to be approximated by a PNG gAMA chunk value of
- * 0.45455 (1/2.2) for PNG. The value implicitly includes any viewing
- * correction required to take account of any differences in the color
- * environment of the original scene and the intended display environment; the
- * value expresses how to *decode* the image for display, not how the original
- * data was *encoded*.
- *
- * sRGB provides a peg for the PNG standard by defining a viewing environment.
- * sRGB itself, and earlier TV standards, actually use a more complex transform
- * (a linear portion then a gamma 2.4 power law) than PNG can express. (PNG is
- * limited to simple power laws.) By saying that an image for direct display on
- * an sRGB conformant system should be stored with a gAMA chunk value of 45455
- * (11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification
- * makes it possible to derive values for other display systems and
- * environments.
- *
- * The Mac value is deduced from the sRGB based on an assumption that the actual
- * extra viewing correction used in early Mac display systems was implemented as
- * a power 1.45 lookup table.
- *
- * Any system where a programmable lookup table is used or where the behavior of
- * the final display device characteristics can be changed requires system
- * specific code to obtain the current characteristic. However this can be
- * difficult and most PNG gamma correction only requires an approximate value.
- *
- * By default, if png_set_alpha_mode() is not called, libpng assumes that all
- * values are unencoded, linear, values and that the output device also has a
- * linear characteristic. This is only very rarely correct - it is invariably
- * better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the
- * default if you don't know what the right answer is!
- *
- * The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS
- * 10.6) which used a correction table to implement a somewhat lower gamma on an
- * otherwise sRGB system.
- *
- * Both these values are reserved (not simple gamma values) in order to allow
- * more precise correction internally in the future.
- *
- * NOTE: the following values can be passed to either the fixed or floating
- * point APIs, but the floating point API will also accept floating point
- * values.
+ * how to decode the output values, not how they are encoded.
*/
#define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */
#define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */
@@ -1964,8 +1884,8 @@ PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr, * It is unlikely that this function works correctly as of 1.6.0 and using it
* may result either in memory leaks or double free of allocated data.
*/
-PNG_EXPORTA(99, void, png_data_freer, (png_const_structrp png_ptr,
- png_inforp info_ptr, int freer, png_uint_32 mask), PNG_DEPRECATED);
+PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
+ png_inforp info_ptr, int freer, png_uint_32 mask));
/* Assignments for png_data_freer */
#define PNG_DESTROY_WILL_FREE_DATA 1
@@ -2007,6 +1927,8 @@ PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr, #else
/* Fatal error in PNG image of libpng - can't continue */
PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN);
+# define png_error(s1,s2) png_err(s1)
+# define png_chunk_error(s1,s2) png_err(s1)
#endif
#ifdef PNG_WARNINGS_SUPPORTED
@@ -2017,6 +1939,9 @@ PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr, /* Non-fatal error in libpng, chunk name is prepended to message. */
PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr,
png_const_charp warning_message));
+#else
+# define png_warning(s1,s2) ((void)(s1))
+# define png_chunk_warning(s1,s2) ((void)(s1))
#endif
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
@@ -2527,11 +2452,15 @@ PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr, #ifdef PNG_INFO_IMAGE_SUPPORTED
/* The "params" pointer is currently not used and is for future expansion. */
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr,
int transforms, png_voidp params));
+#endif
+#ifdef PNG_WRITE_SUPPORTED
PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr,
int transforms, png_voidp params));
#endif
+#endif
PNG_EXPORT(180, png_const_charp, png_get_copyright,
(png_const_structrp png_ptr));
@@ -3312,75 +3241,6 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option, * END OF HARDWARE OPTIONS
******************************************************************************/
-#ifdef PNG_APNG_SUPPORTED
-PNG_EXPORT(245, 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(246, 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(247, png_uint_32, png_get_num_frames, (png_structp png_ptr,
- png_infop info_ptr));
-
-PNG_EXPORT(248, png_uint_32, png_get_num_plays, (png_structp png_ptr,
- png_infop info_ptr));
-
-PNG_EXPORT(249, 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(250, 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(251, png_uint_32, png_get_next_frame_width,
- (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(252, png_uint_32, png_get_next_frame_height,
- (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(253, png_uint_32, png_get_next_frame_x_offset,
- (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(254, png_uint_32, png_get_next_frame_y_offset,
- (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(255, png_uint_16, png_get_next_frame_delay_num,
- (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(256, png_uint_16, png_get_next_frame_delay_den,
- (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(257, png_byte, png_get_next_frame_dispose_op,
- (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(258, png_byte, png_get_next_frame_blend_op,
- (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(259, png_byte, png_get_first_frame_is_hidden,
- (png_structp png_ptr, png_infop info_ptr));
-PNG_EXPORT(260, 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(261, void, png_read_frame_head, (png_structp png_ptr,
- png_infop info_ptr));
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-PNG_EXPORT(262, 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 /* PNG_PROGRESSIVE_READ_SUPPORTED */
-#endif /* PNG_READ_APNG_SUPPORTED */
-
-#ifdef PNG_WRITE_APNG_SUPPORTED
-PNG_EXPORT(263, 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(264, void, png_write_frame_tail, (png_structp png_ptr,
- png_infop info_ptr));
-#endif /* PNG_WRITE_APNG_SUPPORTED */
-#endif /* PNG_APNG_SUPPORTED */
-
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
* defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt
*/
@@ -3390,11 +3250,7 @@ PNG_EXPORT(264, void, png_write_frame_tail, (png_structp png_ptr, * scripts/symbols.def as well.
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
-#ifdef PNG_APNG_SUPPORTED
- PNG_EXPORT_LAST_ORDINAL(264);
-#else
PNG_EXPORT_LAST_ORDINAL(244);
-#endif /* PNG_APNG_SUPPORTED */
#endif
#ifdef __cplusplus
diff --git a/plugins/AdvaImg/src/LibPNG/pngconf.h b/plugins/AdvaImg/src/LibPNG/pngconf.h index 02f74e2639..f11192fa70 100644 --- a/plugins/AdvaImg/src/LibPNG/pngconf.h +++ b/plugins/AdvaImg/src/LibPNG/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.6.3 - July 18, 2013
+ * libpng version 1.6.10 - March 6, 2014
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -361,7 +361,33 @@ * version 1.2.41. Disabling these removes the warnings but may also produce
* less efficient code.
*/
-# if defined(__GNUC__)
+# if defined(__clang__)
+ /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
+# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
+# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
+# endif
+# if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)
+# define PNG_NORETURN __attribute__((__noreturn__))
+# endif
+# if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)
+# define PNG_ALLOCATED __attribute__((__malloc__))
+# endif
+# if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__)
+# define PNG_DEPRECATED __attribute__((__deprecated__))
+# endif
+# if !defined(PNG_PRIVATE)
+# ifdef __has_extension
+# if __has_extension(attribute_unavailable_with_message)
+# define PNG_PRIVATE __attribute__((__unavailable__(\
+ "This function is not exported by libpng.")))
+# endif
+# endif
+# endif
+# ifndef PNG_RESTRICT
+# define PNG_RESTRICT __restrict
+# endif
+
+# elif defined(__GNUC__)
# ifndef PNG_USE_RESULT
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
# endif
@@ -384,12 +410,12 @@ __attribute__((__deprecated__))
# endif
# endif
-# if ((__GNUC__ != 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
+# if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
# ifndef PNG_RESTRICT
# define PNG_RESTRICT __restrict
# endif
-# endif /* __GNUC__ == 3.0 */
-# endif /* __GNUC__ >= 3 */
+# endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */
+# endif /* __GNUC__ >= 3 */
# elif defined(_MSC_VER) && (_MSC_VER >= 1300)
# ifndef PNG_USE_RESULT
@@ -419,7 +445,7 @@ # ifndef PNG_RESTRICT
# define PNG_RESTRICT __restrict
# endif
-# endif /* _MSC_VER */
+# endif
#endif /* PNG_PEDANTIC_WARNINGS */
#ifndef PNG_DEPRECATED
@@ -440,6 +466,7 @@ #ifndef PNG_RESTRICT
# define PNG_RESTRICT /* The C99 "restrict" feature */
#endif
+
#ifndef PNG_FP_EXPORT /* A floating point API. */
# ifdef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FP_EXPORT(ordinal, type, name, args)\
diff --git a/plugins/AdvaImg/src/LibPNG/pngdebug.h b/plugins/AdvaImg/src/LibPNG/pngdebug.h index 96c1ea42b3..99a7aad44f 100644 --- a/plugins/AdvaImg/src/LibPNG/pngdebug.h +++ b/plugins/AdvaImg/src/LibPNG/pngdebug.h @@ -1,11 +1,11 @@ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
*
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
- * Last changed in libpng 1.5.0 [January 6, 2011]
+ * Last changed in libpng 1.6.8 [December 19, 2013]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -25,7 +25,7 @@ * (actually ((void)0)).
*
* level: level of detail of message, starting at 0. A level 'n'
- * message is preceded by 'n' tab characters (not implemented
+ * message is preceded by 'n' 3-space indentations (not implemented
* on Microsoft compilers unless PNG_DEBUG_FILE is also
* defined, to allow debug DLL compilation with no standard IO).
* message: a printf(3) style text string. A trailing '\n' is added
@@ -77,32 +77,29 @@ # endif /* PNG_DEBUG_FILE */
# if (PNG_DEBUG > 1)
-/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
- * non-ISO compilers
- */
# ifdef __STDC__
# ifndef png_debug
# define png_debug(l,m) \
do { \
int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
+ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
+ (num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \
} while (0)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
do { \
int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
+ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
+ (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \
} while (0)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
do { \
int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
+ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
+ (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\
} while (0)
# endif
# else /* __STDC __ */
diff --git a/plugins/AdvaImg/src/LibPNG/pngerror.c b/plugins/AdvaImg/src/LibPNG/pngerror.c index c71e2ab559..7e155cf2d3 100644 --- a/plugins/AdvaImg/src/LibPNG/pngerror.c +++ b/plugins/AdvaImg/src/LibPNG/pngerror.c @@ -1,8 +1,8 @@ /* pngerror.c - stub functions for i/o and memory allocation
*
- * Last changed in libpng 1.6.1 [March 28, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -382,6 +382,10 @@ png_benign_error(png_const_structrp png_ptr, png_const_charp error_message) # endif
png_error(png_ptr, error_message);
}
+
+# ifndef PNG_ERROR_TEXT_SUPPORTED
+ PNG_UNUSED(error_message)
+# endif
}
void /* PRIVATE */
@@ -391,6 +395,10 @@ png_app_warning(png_const_structrp png_ptr, png_const_charp error_message) png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
+
+# ifndef PNG_ERROR_TEXT_SUPPORTED
+ PNG_UNUSED(error_message)
+# endif
}
void /* PRIVATE */
@@ -400,6 +408,10 @@ png_app_error(png_const_structrp png_ptr, png_const_charp error_message) png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
+
+# ifndef PNG_ERROR_TEXT_SUPPORTED
+ PNG_UNUSED(error_message)
+# endif
}
#endif /* BENIGN_ERRORS */
@@ -416,7 +428,8 @@ static PNG_CONST char png_digit[16] = { };
#define PNG_MAX_ERROR_TEXT 196 /* Currently limited be profile_error in png.c */
-#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
+#if defined(PNG_WARNINGS_SUPPORTED) || \
+ (defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
static void /* PRIVATE */
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
error_message)
@@ -506,6 +519,10 @@ png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp else
png_chunk_error(png_ptr, error_message);
+
+# ifndef PNG_ERROR_TEXT_SUPPORTED
+ PNG_UNUSED(error_message)
+# endif
}
#endif
#endif /* PNG_READ_SUPPORTED */
@@ -513,6 +530,10 @@ png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp void /* PRIVATE */
png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
{
+# ifndef PNG_WARNINGS_SUPPORTED
+ PNG_UNUSED(message)
+# endif
+
/* This is always supported, but for just read or just write it
* unconditionally does the right thing.
*/
@@ -740,7 +761,12 @@ png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN) png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
#endif
- /* Here if not setjmp support or if png_ptr is null. */
+ /* If control reaches this point, png_longjmp() must not return. The only
+ * choice is to terminate the whole process (or maybe the thread); to do
+ * this the ANSI-C abort() function is used unless a different method is
+ * implemented by overriding the default configuration setting for
+ * PNG_ABORT().
+ */
PNG_ABORT();
}
@@ -850,8 +876,8 @@ png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode) * possible to implement without setjmp support just so long as there is some
* way to handle the error return here:
*/
-PNG_FUNCTION(void /* PRIVATE */,
-png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message),
+PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI
+png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
PNG_NORETURN)
{
const png_const_structrp png_ptr = png_nonconst_ptr;
@@ -886,7 +912,7 @@ png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message), }
#ifdef PNG_WARNINGS_SUPPORTED
-void /* PRIVATE */
+void /* PRIVATE */ PNGCBAPI
png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
{
const png_const_structrp png_ptr = png_nonconst_ptr;
diff --git a/plugins/AdvaImg/src/LibPNG/pngget.c b/plugins/AdvaImg/src/LibPNG/pngget.c index 6a3eef1873..80ab055dca 100644 --- a/plugins/AdvaImg/src/LibPNG/pngget.c +++ b/plugins/AdvaImg/src/LibPNG/pngget.c @@ -1174,166 +1174,4 @@ png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr) # endif
#endif
-#ifdef PNG_APNG_SUPPORTED
-png_uint_32 PNGAPI
-png_get_acTL(png_structp png_ptr, png_infop info_ptr,
- png_uint_32 *num_frames, png_uint_32 *num_plays)
-{
- png_debug1(1, "in %s retrieval function", "acTL");
-
- if (png_ptr != NULL && info_ptr != NULL &&
- (info_ptr->valid & PNG_INFO_acTL) &&
- num_frames != NULL && num_plays != NULL)
- {
- *num_frames = info_ptr->num_frames;
- *num_plays = info_ptr->num_plays;
- return (1);
- }
-
- return (0);
-}
-
-png_uint_32 PNGAPI
-png_get_num_frames(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_num_frames()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->num_frames);
- return (0);
-}
-
-png_uint_32 PNGAPI
-png_get_num_plays(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_num_plays()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->num_plays);
- return (0);
-}
-
-png_uint_32 PNGAPI
-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_debug1(1, "in %s retrieval function", "fcTL");
-
- if (png_ptr != NULL && info_ptr != NULL &&
- (info_ptr->valid & PNG_INFO_fcTL) &&
- width != NULL && height != NULL &&
- x_offset != NULL && y_offset != NULL &&
- delay_num != NULL && delay_den != NULL &&
- dispose_op != NULL && blend_op != NULL)
- {
- *width = info_ptr->next_frame_width;
- *height = info_ptr->next_frame_height;
- *x_offset = info_ptr->next_frame_x_offset;
- *y_offset = info_ptr->next_frame_y_offset;
- *delay_num = info_ptr->next_frame_delay_num;
- *delay_den = info_ptr->next_frame_delay_den;
- *dispose_op = info_ptr->next_frame_dispose_op;
- *blend_op = info_ptr->next_frame_blend_op;
- return (1);
- }
-
- return (0);
-}
-
-png_uint_32 PNGAPI
-png_get_next_frame_width(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_next_frame_width()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->next_frame_width);
- return (0);
-}
-
-png_uint_32 PNGAPI
-png_get_next_frame_height(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_next_frame_height()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->next_frame_height);
- return (0);
-}
-
-png_uint_32 PNGAPI
-png_get_next_frame_x_offset(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_next_frame_x_offset()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->next_frame_x_offset);
- return (0);
-}
-
-png_uint_32 PNGAPI
-png_get_next_frame_y_offset(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_next_frame_y_offset()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->next_frame_y_offset);
- return (0);
-}
-
-png_uint_16 PNGAPI
-png_get_next_frame_delay_num(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_next_frame_delay_num()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->next_frame_delay_num);
- return (0);
-}
-
-png_uint_16 PNGAPI
-png_get_next_frame_delay_den(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_next_frame_delay_den()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->next_frame_delay_den);
- return (0);
-}
-
-png_byte PNGAPI
-png_get_next_frame_dispose_op(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_next_frame_dispose_op()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->next_frame_dispose_op);
- return (0);
-}
-
-png_byte PNGAPI
-png_get_next_frame_blend_op(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_get_next_frame_blend_op()");
-
- if (png_ptr != NULL && info_ptr != NULL)
- return (info_ptr->next_frame_blend_op);
- return (0);
-}
-
-png_byte PNGAPI
-png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_first_frame_is_hidden()");
-
- if (png_ptr != NULL)
- return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
-
- PNG_UNUSED(info_ptr)
-
- return 0;
-}
-#endif /* PNG_APNG_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
diff --git a/plugins/AdvaImg/src/LibPNG/pnginfo.h b/plugins/AdvaImg/src/LibPNG/pnginfo.h index 94db9ff31c..683b7ea177 100644 --- a/plugins/AdvaImg/src/LibPNG/pnginfo.h +++ b/plugins/AdvaImg/src/LibPNG/pnginfo.h @@ -256,18 +256,5 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_bytepp row_pointers; /* the image bits */
#endif
-#ifdef PNG_APNG_SUPPORTED
- png_uint_32 num_frames; /* including default image */
- png_uint_32 num_plays;
- png_uint_32 next_frame_width;
- png_uint_32 next_frame_height;
- png_uint_32 next_frame_x_offset;
- png_uint_32 next_frame_y_offset;
- png_uint_16 next_frame_delay_num;
- png_uint_16 next_frame_delay_den;
- png_byte next_frame_dispose_op;
- png_byte next_frame_blend_op;
-#endif
-
};
#endif /* PNGINFO_H */
diff --git a/plugins/AdvaImg/src/LibPNG/pnglibconf.h b/plugins/AdvaImg/src/LibPNG/pnglibconf.h index ececc38fc2..1894e2daeb 100644 --- a/plugins/AdvaImg/src/LibPNG/pnglibconf.h +++ b/plugins/AdvaImg/src/LibPNG/pnglibconf.h @@ -1,211 +1,211 @@ -/* libpng 1.6.3 STANDARD API DEFINITION */
-
-/* pnglibconf.h - library build configuration */
-
-/* Libpng version 1.6.3 - July 18, 2013 */
-
-/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */
-
-/* This code is released under the libpng license. */
-/* For conditions of distribution and use, see the disclaimer */
-/* and license in png.h */
-
-/* pnglibconf.h */
-/* Machine generated file: DO NOT EDIT */
-/* Derived from: scripts/pnglibconf.dfa */
-#ifndef PNGLCONF_H
-#define PNGLCONF_H
-/* options */
-#define PNG_16BIT_SUPPORTED
-#define PNG_ALIGNED_MEMORY_SUPPORTED
-/*#undef PNG_ARM_NEON_API_SUPPORTED*/
-/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/
-#define PNG_BENIGN_ERRORS_SUPPORTED
-#define PNG_BENIGN_READ_ERRORS_SUPPORTED
-/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
-#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
-#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
-#define PNG_COLORSPACE_SUPPORTED
-#define PNG_CONSOLE_IO_SUPPORTED
-#define PNG_CONVERT_tIME_SUPPORTED
-#define PNG_EASY_ACCESS_SUPPORTED
-/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
-#define PNG_ERROR_TEXT_SUPPORTED
-#define PNG_FIXED_POINT_SUPPORTED
-#define PNG_FLOATING_ARITHMETIC_SUPPORTED
-#define PNG_FLOATING_POINT_SUPPORTED
-#define PNG_FORMAT_AFIRST_SUPPORTED
-#define PNG_FORMAT_BGR_SUPPORTED
-#define PNG_GAMMA_SUPPORTED
-#define PNG_GET_PALETTE_MAX_SUPPORTED
-#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-#define PNG_INCH_CONVERSIONS_SUPPORTED
-#define PNG_INFO_IMAGE_SUPPORTED
-#define PNG_IO_STATE_SUPPORTED
-#define PNG_MNG_FEATURES_SUPPORTED
-#define PNG_POINTER_INDEXING_SUPPORTED
-#define PNG_PROGRESSIVE_READ_SUPPORTED
-#define PNG_READ_16BIT_SUPPORTED
-#define PNG_READ_ALPHA_MODE_SUPPORTED
-#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
-#define PNG_READ_BACKGROUND_SUPPORTED
-#define PNG_READ_BGR_SUPPORTED
-#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
-#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
-#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
-#define PNG_READ_EXPAND_16_SUPPORTED
-#define PNG_READ_EXPAND_SUPPORTED
-#define PNG_READ_FILLER_SUPPORTED
-#define PNG_READ_GAMMA_SUPPORTED
-#define PNG_READ_GET_PALETTE_MAX_SUPPORTED
-#define PNG_READ_GRAY_TO_RGB_SUPPORTED
-#define PNG_READ_INTERLACING_SUPPORTED
-#define PNG_READ_INT_FUNCTIONS_SUPPORTED
-#define PNG_READ_INVERT_ALPHA_SUPPORTED
-#define PNG_READ_INVERT_SUPPORTED
-#define PNG_READ_OPT_PLTE_SUPPORTED
-#define PNG_READ_PACKSWAP_SUPPORTED
-#define PNG_READ_PACK_SUPPORTED
-#define PNG_READ_QUANTIZE_SUPPORTED
-#define PNG_READ_RGB_TO_GRAY_SUPPORTED
-#define PNG_READ_SCALE_16_TO_8_SUPPORTED
-#define PNG_READ_SHIFT_SUPPORTED
-#define PNG_READ_STRIP_16_TO_8_SUPPORTED
-#define PNG_READ_STRIP_ALPHA_SUPPORTED
-#define PNG_READ_SUPPORTED
-#define PNG_READ_SWAP_ALPHA_SUPPORTED
-#define PNG_READ_SWAP_SUPPORTED
-#define PNG_READ_TEXT_SUPPORTED
-#define PNG_READ_TRANSFORMS_SUPPORTED
-#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_READ_USER_CHUNKS_SUPPORTED
-#define PNG_READ_USER_TRANSFORM_SUPPORTED
-#define PNG_READ_bKGD_SUPPORTED
-#define PNG_READ_cHRM_SUPPORTED
-#define PNG_READ_gAMA_SUPPORTED
-#define PNG_READ_hIST_SUPPORTED
-#define PNG_READ_iCCP_SUPPORTED
-#define PNG_READ_iTXt_SUPPORTED
-#define PNG_READ_oFFs_SUPPORTED
-#define PNG_READ_pCAL_SUPPORTED
-#define PNG_READ_pHYs_SUPPORTED
-#define PNG_READ_sBIT_SUPPORTED
-#define PNG_READ_sCAL_SUPPORTED
-#define PNG_READ_sPLT_SUPPORTED
-#define PNG_READ_sRGB_SUPPORTED
-#define PNG_READ_tEXt_SUPPORTED
-#define PNG_READ_tIME_SUPPORTED
-#define PNG_READ_tRNS_SUPPORTED
-#define PNG_READ_zTXt_SUPPORTED
-/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
-#define PNG_SAVE_INT_32_SUPPORTED
-#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_SEQUENTIAL_READ_SUPPORTED
-#define PNG_SETJMP_SUPPORTED
-#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
-#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
-#define PNG_SET_OPTION_SUPPORTED
-#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_SET_USER_LIMITS_SUPPORTED
-#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
-#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED
-#define PNG_SIMPLIFIED_READ_SUPPORTED
-#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
-#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
-#define PNG_SIMPLIFIED_WRITE_SUPPORTED
-#define PNG_STDIO_SUPPORTED
-#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_TEXT_SUPPORTED
-#define PNG_TIME_RFC1123_SUPPORTED
-#define PNG_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_USER_CHUNKS_SUPPORTED
-#define PNG_USER_LIMITS_SUPPORTED
-#define PNG_USER_MEM_SUPPORTED
-#define PNG_USER_TRANSFORM_INFO_SUPPORTED
-#define PNG_USER_TRANSFORM_PTR_SUPPORTED
-#define PNG_WARNINGS_SUPPORTED
-#define PNG_WRITE_16BIT_SUPPORTED
-#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
-#define PNG_WRITE_BGR_SUPPORTED
-#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
-#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
-#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
-#define PNG_WRITE_FILLER_SUPPORTED
-#define PNG_WRITE_FILTER_SUPPORTED
-#define PNG_WRITE_FLUSH_SUPPORTED
-#define PNG_WRITE_GET_PALETTE_MAX_SUPPORTED
-#define PNG_WRITE_INTERLACING_SUPPORTED
-#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
-#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
-#define PNG_WRITE_INVERT_SUPPORTED
-#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
-#define PNG_WRITE_PACKSWAP_SUPPORTED
-#define PNG_WRITE_PACK_SUPPORTED
-#define PNG_WRITE_SHIFT_SUPPORTED
-#define PNG_WRITE_SUPPORTED
-#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
-#define PNG_WRITE_SWAP_SUPPORTED
-#define PNG_WRITE_TEXT_SUPPORTED
-#define PNG_WRITE_TRANSFORMS_SUPPORTED
-#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
-#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
-#define PNG_WRITE_bKGD_SUPPORTED
-#define PNG_WRITE_cHRM_SUPPORTED
-#define PNG_WRITE_gAMA_SUPPORTED
-#define PNG_WRITE_hIST_SUPPORTED
-#define PNG_WRITE_iCCP_SUPPORTED
-#define PNG_WRITE_iTXt_SUPPORTED
-#define PNG_WRITE_oFFs_SUPPORTED
-#define PNG_WRITE_pCAL_SUPPORTED
-#define PNG_WRITE_pHYs_SUPPORTED
-#define PNG_WRITE_sBIT_SUPPORTED
-#define PNG_WRITE_sCAL_SUPPORTED
-#define PNG_WRITE_sPLT_SUPPORTED
-#define PNG_WRITE_sRGB_SUPPORTED
-#define PNG_WRITE_tEXt_SUPPORTED
-#define PNG_WRITE_tIME_SUPPORTED
-#define PNG_WRITE_tRNS_SUPPORTED
-#define PNG_WRITE_zTXt_SUPPORTED
-#define PNG_bKGD_SUPPORTED
-#define PNG_cHRM_SUPPORTED
-#define PNG_gAMA_SUPPORTED
-#define PNG_hIST_SUPPORTED
-#define PNG_iCCP_SUPPORTED
-#define PNG_iTXt_SUPPORTED
-#define PNG_oFFs_SUPPORTED
-#define PNG_pCAL_SUPPORTED
-#define PNG_pHYs_SUPPORTED
-#define PNG_sBIT_SUPPORTED
-#define PNG_sCAL_SUPPORTED
-#define PNG_sPLT_SUPPORTED
-#define PNG_sRGB_SUPPORTED
-#define PNG_tEXt_SUPPORTED
-#define PNG_tIME_SUPPORTED
-#define PNG_tRNS_SUPPORTED
-#define PNG_zTXt_SUPPORTED
-/* end of options */
-/* settings */
-#define PNG_API_RULE 0
-#define PNG_CALLOC_SUPPORTED
-#define PNG_COST_SHIFT 3
-#define PNG_DEFAULT_READ_MACROS 1
-#define PNG_GAMMA_THRESHOLD_FIXED 5000
-#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
-#define PNG_INFLATE_BUF_SIZE 1024
-#define PNG_MAX_GAMMA_8 11
-#define PNG_QUANTIZE_BLUE_BITS 5
-#define PNG_QUANTIZE_GREEN_BITS 5
-#define PNG_QUANTIZE_RED_BITS 5
-#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1)
-#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
-#define PNG_WEIGHT_SHIFT 8
-#define PNG_ZBUF_SIZE 8192
-#define PNG_ZLIB_VERNUM 0 /* unknown */
-#define PNG_Z_DEFAULT_COMPRESSION (-1)
-#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
-#define PNG_Z_DEFAULT_STRATEGY 1
-#define PNG_sCAL_PRECISION 5
-#define PNG_sRGB_PROFILE_CHECKS 2
-/* end of settings */
-#endif /* PNGLCONF_H */
+/* libpng 1.6.1 STANDARD API DEFINITION */ + +/* pnglibconf.h - library build configuration */ + +/* Libpng version 1.6.1 - March 28, 2013 */ + +/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */ + +/* This code is released under the libpng license. */ +/* For conditions of distribution and use, see the disclaimer */ +/* and license in png.h */ + +/* pnglibconf.h */ +/* Machine generated file: DO NOT EDIT */ +/* Derived from: scripts/pnglibconf.dfa */ +#ifndef PNGLCONF_H +#define PNGLCONF_H +/* options */ +#define PNG_16BIT_SUPPORTED +#define PNG_ALIGNED_MEMORY_SUPPORTED +/*#undef PNG_ARM_NEON_API_SUPPORTED*/ +/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/ +/*#undef PNG_ARM_NEON_SUPPORTED*/ +#define PNG_BENIGN_ERRORS_SUPPORTED +#define PNG_BENIGN_READ_ERRORS_SUPPORTED +/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/ +#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED +#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED +#define PNG_COLORSPACE_SUPPORTED +#define PNG_CONSOLE_IO_SUPPORTED +#define PNG_CONVERT_tIME_SUPPORTED +#define PNG_EASY_ACCESS_SUPPORTED +/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/ +#define PNG_ERROR_TEXT_SUPPORTED +#define PNG_FIXED_POINT_SUPPORTED +#define PNG_FLOATING_ARITHMETIC_SUPPORTED +#define PNG_FLOATING_POINT_SUPPORTED +#define PNG_FORMAT_AFIRST_SUPPORTED +#define PNG_FORMAT_BGR_SUPPORTED +#define PNG_GAMMA_SUPPORTED +#define PNG_GET_PALETTE_MAX_SUPPORTED +#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +#define PNG_INCH_CONVERSIONS_SUPPORTED +#define PNG_INFO_IMAGE_SUPPORTED +#define PNG_IO_STATE_SUPPORTED +#define PNG_MNG_FEATURES_SUPPORTED +#define PNG_POINTER_INDEXING_SUPPORTED +#define PNG_PROGRESSIVE_READ_SUPPORTED +#define PNG_READ_16BIT_SUPPORTED +#define PNG_READ_ALPHA_MODE_SUPPORTED +#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED +#define PNG_READ_BACKGROUND_SUPPORTED +#define PNG_READ_BGR_SUPPORTED +#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED +#define PNG_READ_COMPOSITE_NODIV_SUPPORTED +#define PNG_READ_COMPRESSED_TEXT_SUPPORTED +#define PNG_READ_EXPAND_16_SUPPORTED +#define PNG_READ_EXPAND_SUPPORTED +#define PNG_READ_FILLER_SUPPORTED +#define PNG_READ_GAMMA_SUPPORTED +#define PNG_READ_GET_PALETTE_MAX_SUPPORTED +#define PNG_READ_GRAY_TO_RGB_SUPPORTED +#define PNG_READ_INTERLACING_SUPPORTED +#define PNG_READ_INT_FUNCTIONS_SUPPORTED +#define PNG_READ_INVERT_ALPHA_SUPPORTED +#define PNG_READ_INVERT_SUPPORTED +#define PNG_READ_OPT_PLTE_SUPPORTED +#define PNG_READ_PACKSWAP_SUPPORTED +#define PNG_READ_PACK_SUPPORTED +#define PNG_READ_QUANTIZE_SUPPORTED +#define PNG_READ_RGB_TO_GRAY_SUPPORTED +#define PNG_READ_SCALE_16_TO_8_SUPPORTED +#define PNG_READ_SHIFT_SUPPORTED +#define PNG_READ_STRIP_16_TO_8_SUPPORTED +#define PNG_READ_STRIP_ALPHA_SUPPORTED +#define PNG_READ_SUPPORTED +#define PNG_READ_SWAP_ALPHA_SUPPORTED +#define PNG_READ_SWAP_SUPPORTED +#define PNG_READ_TEXT_SUPPORTED +#define PNG_READ_TRANSFORMS_SUPPORTED +#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +#define PNG_READ_USER_CHUNKS_SUPPORTED +#define PNG_READ_USER_TRANSFORM_SUPPORTED +#define PNG_READ_bKGD_SUPPORTED +#define PNG_READ_cHRM_SUPPORTED +#define PNG_READ_gAMA_SUPPORTED +#define PNG_READ_hIST_SUPPORTED +#define PNG_READ_iCCP_SUPPORTED +#define PNG_READ_iTXt_SUPPORTED +#define PNG_READ_oFFs_SUPPORTED +#define PNG_READ_pCAL_SUPPORTED +#define PNG_READ_pHYs_SUPPORTED +#define PNG_READ_sBIT_SUPPORTED +#define PNG_READ_sCAL_SUPPORTED +#define PNG_READ_sPLT_SUPPORTED +#define PNG_READ_sRGB_SUPPORTED +#define PNG_READ_tEXt_SUPPORTED +#define PNG_READ_tIME_SUPPORTED +#define PNG_READ_tRNS_SUPPORTED +#define PNG_READ_zTXt_SUPPORTED +/*#undef PNG_SAFE_LIMITS_SUPPORTED*/ +#define PNG_SAVE_INT_32_SUPPORTED +#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED +#define PNG_SEQUENTIAL_READ_SUPPORTED +#define PNG_SETJMP_SUPPORTED +#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED +#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED +/*#undef PNG_SET_OPTION_SUPPORTED*/ +#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED +#define PNG_SET_USER_LIMITS_SUPPORTED +#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED +#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED +#define PNG_SIMPLIFIED_READ_SUPPORTED +#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED +#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED +#define PNG_SIMPLIFIED_WRITE_SUPPORTED +#define PNG_STDIO_SUPPORTED +#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED +#define PNG_TEXT_SUPPORTED +#define PNG_TIME_RFC1123_SUPPORTED +#define PNG_UNKNOWN_CHUNKS_SUPPORTED +#define PNG_USER_CHUNKS_SUPPORTED +#define PNG_USER_LIMITS_SUPPORTED +#define PNG_USER_MEM_SUPPORTED +#define PNG_USER_TRANSFORM_INFO_SUPPORTED +#define PNG_USER_TRANSFORM_PTR_SUPPORTED +#define PNG_WARNINGS_SUPPORTED +#define PNG_WRITE_16BIT_SUPPORTED +#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED +#define PNG_WRITE_BGR_SUPPORTED +#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED +#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED +#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED +#define PNG_WRITE_FILLER_SUPPORTED +#define PNG_WRITE_FILTER_SUPPORTED +#define PNG_WRITE_FLUSH_SUPPORTED +#define PNG_WRITE_GET_PALETTE_MAX_SUPPORTED +#define PNG_WRITE_INTERLACING_SUPPORTED +#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED +#define PNG_WRITE_INVERT_ALPHA_SUPPORTED +#define PNG_WRITE_INVERT_SUPPORTED +#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED +#define PNG_WRITE_PACKSWAP_SUPPORTED +#define PNG_WRITE_PACK_SUPPORTED +#define PNG_WRITE_SHIFT_SUPPORTED +#define PNG_WRITE_SUPPORTED +#define PNG_WRITE_SWAP_ALPHA_SUPPORTED +#define PNG_WRITE_SWAP_SUPPORTED +#define PNG_WRITE_TEXT_SUPPORTED +#define PNG_WRITE_TRANSFORMS_SUPPORTED +#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED +#define PNG_WRITE_USER_TRANSFORM_SUPPORTED +#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED +#define PNG_WRITE_bKGD_SUPPORTED +#define PNG_WRITE_cHRM_SUPPORTED +#define PNG_WRITE_gAMA_SUPPORTED +#define PNG_WRITE_hIST_SUPPORTED +#define PNG_WRITE_iCCP_SUPPORTED +#define PNG_WRITE_iTXt_SUPPORTED +#define PNG_WRITE_oFFs_SUPPORTED +#define PNG_WRITE_pCAL_SUPPORTED +#define PNG_WRITE_pHYs_SUPPORTED +#define PNG_WRITE_sBIT_SUPPORTED +#define PNG_WRITE_sCAL_SUPPORTED +#define PNG_WRITE_sPLT_SUPPORTED +#define PNG_WRITE_sRGB_SUPPORTED +#define PNG_WRITE_tEXt_SUPPORTED +#define PNG_WRITE_tIME_SUPPORTED +#define PNG_WRITE_tRNS_SUPPORTED +#define PNG_WRITE_zTXt_SUPPORTED +#define PNG_bKGD_SUPPORTED +#define PNG_cHRM_SUPPORTED +#define PNG_gAMA_SUPPORTED +#define PNG_hIST_SUPPORTED +#define PNG_iCCP_SUPPORTED +#define PNG_iTXt_SUPPORTED +#define PNG_oFFs_SUPPORTED +#define PNG_pCAL_SUPPORTED +#define PNG_pHYs_SUPPORTED +#define PNG_sBIT_SUPPORTED +#define PNG_sCAL_SUPPORTED +#define PNG_sPLT_SUPPORTED +#define PNG_sRGB_SUPPORTED +#define PNG_tEXt_SUPPORTED +#define PNG_tIME_SUPPORTED +#define PNG_tRNS_SUPPORTED +#define PNG_zTXt_SUPPORTED +/* end of options */ +/* settings */ +#define PNG_API_RULE 0 +#define PNG_CALLOC_SUPPORTED +#define PNG_COST_SHIFT 3 +#define PNG_DEFAULT_READ_MACROS 1 +#define PNG_GAMMA_THRESHOLD_FIXED 5000 +#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE +#define PNG_INFLATE_BUF_SIZE 1024 +#define PNG_MAX_GAMMA_8 11 +#define PNG_QUANTIZE_BLUE_BITS 5 +#define PNG_QUANTIZE_GREEN_BITS 5 +#define PNG_QUANTIZE_RED_BITS 5 +#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1) +#define PNG_TEXT_Z_DEFAULT_STRATEGY 0 +#define PNG_WEIGHT_SHIFT 8 +#define PNG_ZBUF_SIZE 8192 +#define PNG_Z_DEFAULT_COMPRESSION (-1) +#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0 +#define PNG_Z_DEFAULT_STRATEGY 1 +#define PNG_sCAL_PRECISION 5 +#define PNG_sRGB_PROFILE_CHECKS 2 +/* end of settings */ +#endif /* PNGLCONF_H */ diff --git a/plugins/AdvaImg/src/LibPNG/pngmem.c b/plugins/AdvaImg/src/LibPNG/pngmem.c index adae736699..ba643a9fb1 100644 --- a/plugins/AdvaImg/src/LibPNG/pngmem.c +++ b/plugins/AdvaImg/src/LibPNG/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.8 [December 19, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -73,9 +73,10 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size), * to implement a user memory handler. This checks to be sure it isn't
* called with big numbers.
*/
-#ifdef PNG_USER_MEM_SUPPORTED
+#ifndef PNG_USER_MEM_SUPPORTED
PNG_UNUSED(png_ptr)
#endif
+
if (size > 0 && size <= PNG_SIZE_MAX
# ifdef PNG_MAX_MALLOC_64K
&& size <= 65536U
@@ -95,6 +96,8 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size), return NULL;
}
+#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
+ defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
/* This is really here only to work round a spurious warning in GCC 4.6 and 4.7
* that arises because of the checks in png_realloc_array that are repeated in
* png_malloc_array.
@@ -156,6 +159,7 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array, return NULL; /* error */
}
+#endif /* TEXT || sPLT || STORE_UNKNOWN_CHUNKS */
/* Various functions that have different error handling are derived from this.
* png_malloc always exists, but if PNG_USER_MEM_SUPPORTED is defined a separate
diff --git a/plugins/AdvaImg/src/LibPNG/pngpread.c b/plugins/AdvaImg/src/LibPNG/pngpread.c index 6c06d81ee9..eec5983833 100644 --- a/plugins/AdvaImg/src/LibPNG/pngpread.c +++ b/plugins/AdvaImg/src/LibPNG/pngpread.c @@ -1,8 +1,8 @@ /* pngpread.c - read a png file in push mode
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -217,109 +217,6 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) chunk_name = png_ptr->chunk_name;
-#ifdef PNG_READ_APNG_SUPPORTED
- if (png_ptr->num_frames_read > 0 &&
- png_ptr->num_frames_read < info_ptr->num_frames)
- {
- if (chunk_name == png_IDAT)
- {
- /* Discard trailing IDATs for the first frame */
- if (png_ptr->mode & PNG_HAVE_fcTL || png_ptr->num_frames_read > 1)
- png_error(png_ptr, "out of place IDAT");
-
- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
-
- png_push_crc_skip(png_ptr, png_ptr->push_length);
- png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
- return;
- }
- else if (chunk_name == png_fdAT)
- {
- if (png_ptr->buffer_size < 4)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
-
- png_ensure_sequence_number(png_ptr, 4);
-
- if (!(png_ptr->mode & PNG_HAVE_fcTL))
- {
- /* Discard trailing fdATs for frames other than the first */
- if (png_ptr->num_frames_read < 2)
- png_error(png_ptr, "out of place fdAT");
-
- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
-
- png_push_crc_skip(png_ptr, png_ptr->push_length);
- png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
- return;
- }
-
- else
- {
- /* frame data follows */
- png_ptr->idat_size = png_ptr->push_length - 4;
- png_ptr->mode |= PNG_HAVE_IDAT;
- png_ptr->process_mode = PNG_READ_IDAT_MODE;
-
- return;
- }
- }
-
- else if (chunk_name == png_fcTL)
- {
- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
-
- png_read_reset(png_ptr);
- png_ptr->mode &= ~PNG_HAVE_fcTL;
-
- png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
-
- if (!(png_ptr->mode & PNG_HAVE_fcTL))
- png_error(png_ptr, "missing required fcTL chunk");
-
- png_read_reinit(png_ptr, info_ptr);
- png_progressive_read_reset(png_ptr);
-
- if (png_ptr->frame_info_fn != NULL)
- (*(png_ptr->frame_info_fn))(png_ptr, png_ptr->num_frames_read);
-
- png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
-
- return;
- }
-
- else
- {
- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
- png_warning(png_ptr, "Skipped (ignored) a chunk "
- "between APNG chunks");
- png_push_crc_skip(png_ptr, png_ptr->push_length);
- png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
- return;
- }
-
- return;
- }
-#endif /* PNG_READ_APNG_SUPPORTED */
-
if (chunk_name == png_IDAT)
{
if (png_ptr->mode & PNG_AFTER_IDAT)
@@ -337,6 +234,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) png_error(png_ptr, "Missing PLTE before IDAT");
png_ptr->mode |= PNG_HAVE_IDAT;
+ png_ptr->process_mode = PNG_READ_IDAT_MODE;
if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
if (png_ptr->push_length == 0)
@@ -388,8 +286,8 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) if (chunk_name == png_PLTE)
png_ptr->mode |= PNG_HAVE_PLTE;
}
-
#endif
+
else if (chunk_name == png_PLTE)
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -402,9 +300,6 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) else if (chunk_name == png_IDAT)
{
-#ifdef PNG_READ_APNG_SUPPORTED
- png_have_info(png_ptr, info_ptr);
-#endif
png_ptr->idat_size = png_ptr->push_length;
png_ptr->process_mode = PNG_READ_IDAT_MODE;
png_push_have_info(png_ptr, info_ptr);
@@ -634,32 +529,8 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
}
-
#endif
-#ifdef PNG_READ_APNG_SUPPORTED
- else if (chunk_name == png_acTL)
- {
- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
-
- png_handle_acTL(png_ptr, info_ptr, png_ptr->push_length);
- }
- else if (chunk_name == png_fcTL)
- {
- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
-
- png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
- }
-
-#endif /* PNG_READ_APNG_SUPPORTED */
else
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -861,11 +732,7 @@ png_push_read_IDAT(png_structrp png_ptr) png_byte chunk_tag[4];
/* TODO: this code can be commoned up with the same code in push_read */
-#ifdef PNG_READ_APNG_SUPPORTED
- if (png_ptr->buffer_size < 12)
-#else
if (png_ptr->buffer_size < 8)
-#endif
{
png_push_save_buffer(png_ptr);
return;
@@ -878,64 +745,17 @@ png_push_read_IDAT(png_structrp png_ptr) png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
-#ifdef PNG_READ_APNG_SUPPORTED
- if (png_ptr->chunk_name != png_fdAT && png_ptr->num_frames_read > 0)
- {
- if (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED)
- {
- png_ptr->process_mode = PNG_READ_CHUNK_MODE;
- if (png_ptr->frame_end_fn != NULL)
- (*(png_ptr->frame_end_fn))(png_ptr, png_ptr->num_frames_read);
- png_ptr->num_frames_read++;
- return;
- }
- else
- {
- if (png_ptr->chunk_name == png_IEND)
- png_error(png_ptr, "Not enough image data");
- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
- png_warning(png_ptr, "Skipping (ignoring) a chunk between "
- "APNG chunks");
- png_crc_finish(png_ptr, png_ptr->push_length);
- png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
- return;
- }
- }
- else
-#endif
-#ifdef PNG_READ_APNG_SUPPORTED
- if (png_ptr->chunk_name != png_IDAT && png_ptr->num_frames_read == 0)
-#else
if (png_ptr->chunk_name != png_IDAT)
-#endif
{
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
if (!(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
png_error(png_ptr, "Not enough compressed data");
-#ifdef PNG_READ_APNG_SUPPORTED
- if (png_ptr->frame_end_fn != NULL)
- (*(png_ptr->frame_end_fn))(png_ptr, png_ptr->num_frames_read);
- png_ptr->num_frames_read++;
-#endif
-
return;
}
png_ptr->idat_size = png_ptr->push_length;
-
-#ifdef PNG_READ_APNG_SUPPORTED
- if (png_ptr->num_frames_read > 0)
- {
- png_ensure_sequence_number(png_ptr, 4);
- png_ptr->idat_size -= 4;
- }
-#endif
}
if (png_ptr->idat_size && png_ptr->save_buffer_size)
@@ -1013,15 +833,6 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer, if (!(buffer_length > 0) || buffer == NULL)
png_error(png_ptr, "No IDAT data (internal error)");
-#ifdef PNG_READ_APNG_SUPPORTED
- /* If the app is not APNG-aware, decode only the first frame */
- if (!(png_ptr->apng_flags & PNG_APNG_APP) && png_ptr->num_frames_read > 0)
- {
- png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
- return;
- }
-#endif
-
/* This routine must process all the data it has been given
* before returning, calling the row callback as required to
* handle the uncompressed results.
@@ -1470,18 +1281,6 @@ png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr, png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
}
-#ifdef PNG_READ_APNG_SUPPORTED
-void PNGAPI
-png_set_progressive_frame_fn(png_structp png_ptr,
- png_progressive_frame_ptr frame_info_fn,
- png_progressive_frame_ptr frame_end_fn)
-{
- png_ptr->frame_info_fn = frame_info_fn;
- png_ptr->frame_end_fn = frame_end_fn;
- png_ptr->apng_flags |= PNG_APNG_APP;
-}
-#endif
-
png_voidp PNGAPI
png_get_progressive_ptr(png_const_structrp png_ptr)
{
diff --git a/plugins/AdvaImg/src/LibPNG/pngpriv.h b/plugins/AdvaImg/src/LibPNG/pngpriv.h index 9eb2fd229b..db8f33c37b 100644 --- a/plugins/AdvaImg/src/LibPNG/pngpriv.h +++ b/plugins/AdvaImg/src/LibPNG/pngpriv.h @@ -2,11 +2,11 @@ /* pngpriv.h - private declarations for use inside libpng
*
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
- * Last changed in libpng 1.6.3 [July 18, 2013]
+ * Last changed in libpng 1.6.10 [March 6, 2014]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -112,9 +112,15 @@ * typically the target FPU. If the FPU has been set to NEON (-mfpu=neon
* with GCC) then the compiler will define __ARM_NEON__ and we can rely
* unconditionally on NEON instructions not crashing, otherwise we must
- * disable use of NEON instructions:
+ * disable use of NEON instructions.
+ *
+ * NOTE: at present these optimizations depend on 'ALIGNED_MEMORY', so they
+ * can only be turned on automatically if that is supported too. If
+ * PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail
+ * to compile with an appropriate #error if ALIGNED_MEMORY has been turned
+ * off.
*/
-# ifdef __ARM_NEON__
+# if defined(__ARM_NEON__) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
# define PNG_ARM_NEON_OPT 2
# else
# define PNG_ARM_NEON_OPT 0
@@ -126,7 +132,49 @@ * callbacks to do this.
*/
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
-#endif
+
+ /* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
+ * if possible - if __ARM_NEON__ is set and the compiler version is not known
+ * to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can
+ * be:
+ *
+ * 1 The intrinsics code (the default with __ARM_NEON__)
+ * 2 The hand coded assembler (the default without __ARM_NEON__)
+ *
+ * It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
+ * this is *NOT* supported and may cease to work even after a minor revision
+ * to libpng. It *is* valid to do this for testing purposes, e.g. speed
+ * testing or a new compiler, but the results should be communicated to the
+ * libpng implementation list for incorporation in the next minor release.
+ */
+# ifndef PNG_ARM_NEON_IMPLEMENTATION
+# ifdef __ARM_NEON__
+# if defined(__clang__)
+ /* At present it is unknown by the libpng developers which versions
+ * of clang support the intrinsics, however some or perhaps all
+ * versions do not work with the assembler so this may be
+ * irrelevant, so just use the default (do nothing here.)
+ */
+# elif defined(__GNUC__)
+ /* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
+ * work, so if this *is* GCC, or G++, look for a version >4.5
+ */
+# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
+# define PNG_ARM_NEON_IMPLEMENTATION 2
+# endif /* no GNUC support */
+# endif /* __GNUC__ */
+# else /* !defined __ARM_NEON__ */
+ /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
+ */
+# define PNG_ARM_NEON_IMPLEMENTATION 2
+# endif /* __ARM_NEON__ */
+# endif /* !defined PNG_ARM_NEON_IMPLEMENTATION */
+
+# ifndef PNG_ARM_NEON_IMPLEMENTATION
+ /* Use the intrinsics code by default. */
+# define PNG_ARM_NEON_IMPLEMENTATION 1
+# endif
+#endif /* PNG_ARM_NEON_OPT > 0 */
/* Is this a build of a DLL where compilation of the object modules requires
* different preprocessor settings to those required for a simple library? If
@@ -206,6 +254,11 @@ extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
#endif
+#ifndef PNG_INTERNAL_CALLBACK
+# define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
+ extern PNG_FUNCTION(type, (PNGCBAPI name), args, PNG_EMPTY attributes)
+#endif
+
/* If floating or fixed point APIs are disabled they may still be compiled
* internally. To handle this make sure they are declared as the appropriate
* internal extern function (otherwise the symbol prefixing stuff won't work and
@@ -325,8 +378,6 @@ #ifdef PNG_WARNINGS_SUPPORTED
# define PNG_WARNING_PARAMETERS(p) png_warning_parameters p;
#else
-# define png_warning(s1,s2) ((void)(s1))
-# define png_chunk_warning(s1,s2) ((void)(s1))
# define png_warning_parameter(p,number,string) ((void)0)
# define png_warning_parameter_unsigned(p,number,format,value) ((void)0)
# define png_warning_parameter_signed(p,number,format,value) ((void)0)
@@ -334,8 +385,6 @@ # define PNG_WARNING_PARAMETERS(p)
#endif
#ifndef PNG_ERROR_TEXT_SUPPORTED
-# define png_error(s1,s2) png_err(s1)
-# define png_chunk_error(s1,s2) png_err(s1)
# define png_fixed_error(s1,s2) png_err(s1)
#endif
@@ -502,10 +551,6 @@ #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
/* 0x4000 (unused) */
#define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */
-#ifdef PNG_APNG_SUPPORTED
-#define PNG_HAVE_acTL 0x10000
-#define PNG_HAVE_fcTL 0x20000
-#endif
/* Flags for the transformations the PNG library does on the image data */
#define PNG_BGR 0x0001
@@ -727,16 +772,6 @@ #define png_tRNS PNG_U32(116, 82, 78, 83)
#define png_zTXt PNG_U32(122, 84, 88, 116)
-#ifdef PNG_APNG_SUPPORTED
-#define png_acTL PNG_U32( 97, 99, 84, 76)
-#define png_fcTL PNG_U32(102, 99, 84, 76)
-#define png_fdAT PNG_U32(102, 100, 65, 84)
-
-/* For png_struct.apng_flags: */
-#define PNG_FIRST_FRAME_HIDDEN 0x0001
-#define PNG_APNG_APP 0x0002
-#endif
-
/* 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.
*/
@@ -1190,7 +1225,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr), PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
PNG_EMPTY);
/* Finish a row while reading, dealing with interlacing passes, etc. */
-#endif
+#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
/* Initialize the row buffers, etc. */
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
@@ -1201,32 +1236,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr, png_inforp info_ptr),PNG_EMPTY);
#endif
-/* These are the functions that do the transformations */
-#ifdef PNG_READ_FILLER_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_read_filler,(png_row_infop row_info,
- png_bytep row, png_uint_32 filler, png_uint_32 flags),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_read_swap_alpha,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
-#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_write_swap_alpha,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_read_invert_alpha,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
-#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_write_invert_alpha,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
+/* Shared transform functions, defined in pngtran.c */
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info,
@@ -1246,96 +1256,16 @@ PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info, png_bytep row),PNG_EMPTY);
#endif
-#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
-PNG_INTERNAL_FUNCTION(int,png_do_rgb_to_gray,(png_structrp png_ptr,
- png_row_infop row_info, png_bytep row),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_gray_to_rgb,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_PACK_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_unpack,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_SHIFT_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_unshift,(png_row_infop row_info,
- png_bytep row, png_const_color_8p sig_bits),PNG_EMPTY);
-#endif
-
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info,
png_bytep row),PNG_EMPTY);
#endif
-#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_scale_16_to_8,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_chop,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_QUANTIZE_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_quantize,(png_row_infop row_info,
- png_bytep row, png_const_bytep palette_lookup,
- png_const_bytep quantize_lookup),PNG_EMPTY);
-
-# ifdef PNG_CORRECT_PALETTE_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_correct_palette,(png_structrp png_ptr,
- png_colorp palette, int num_palette),PNG_EMPTY);
-# endif
-#endif
-
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info,
png_bytep row),PNG_EMPTY);
#endif
-#ifdef PNG_WRITE_PACK_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_pack,(png_row_infop row_info,
- png_bytep row, png_uint_32 bit_depth),PNG_EMPTY);
-#endif
-
-#ifdef PNG_WRITE_SHIFT_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_shift,(png_row_infop row_info,
- png_bytep row, png_const_color_8p bit_depth),PNG_EMPTY);
-#endif
-
-#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
- defined(PNG_READ_ALPHA_MODE_SUPPORTED)
-PNG_INTERNAL_FUNCTION(void,png_do_compose,(png_row_infop row_info,
- png_bytep row, png_structrp png_ptr),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_GAMMA_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_gamma,(png_row_infop row_info,
- png_bytep row, png_structrp png_ptr),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_encode_alpha,(png_row_infop row_info,
- png_bytep row, png_structrp png_ptr),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_EXPAND_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_expand_palette,(png_row_infop row_info,
- png_bytep row, png_const_colorp palette, png_const_bytep trans,
- int num_trans),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_do_expand,(png_row_infop row_info,
- png_bytep row, png_const_color_16p trans_color),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_EXPAND_16_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_expand_16,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
/* The following decodes the appropriate chunks, and does error correction,
* then calls the appropriate callback for the chunk if it is valid.
*/
@@ -1436,7 +1366,6 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr,
png_uint_32 chunk_name),PNG_EMPTY);
-#ifdef PNG_READ_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
/* This is the function that gets called for unknown chunks. The 'keep'
@@ -1445,16 +1374,14 @@ PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, * just skips the chunk or errors out if it is critical.
*/
-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
-#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
+#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
+ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
(png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
/* Exactly as the API png_handle_as_unknown() except that the argument is a
* 32-bit chunk name, not a string.
*/
-#endif
-#endif /* PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */
-#endif /* PNG_READ_SUPPORTED */
+#endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
/* Handle the transformations for reading and writing */
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
@@ -1525,56 +1452,6 @@ PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr, #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
-#ifdef PNG_MNG_FEATURES_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_read_intrapixel,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_do_write_intrapixel,(png_row_infop row_info,
- png_bytep row),PNG_EMPTY);
-#endif
-
-#ifdef PNG_APNG_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_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_EMPTY);
-
-#ifdef PNG_READ_APNG_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_acTL,(png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_handle_fcTL,(png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_handle_fdAT,(png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_have_info,(png_structp png_ptr,
- png_infop info_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_ensure_sequence_number,(png_structp png_ptr,
- png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_reset,(png_structp png_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_reinit,(png_structp png_ptr,
- png_infop info_ptr),PNG_EMPTY);
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_progressive_read_reset,(png_structp png_ptr),
- PNG_EMPTY);
-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
-#endif /* PNG_READ_APNG_SUPPORTED */
-
-#ifdef PNG_WRITE_APNG_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_acTL,(png_structp png_ptr,
- png_uint_32 num_frames, png_uint_32 num_plays),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_write_fcTL,(png_structp png_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_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_write_fdAT,(png_structp png_ptr,
- png_const_bytep data, png_size_t length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_write_reset,(png_structp png_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_write_reinit,(png_structp png_ptr,
- png_infop info_ptr, png_uint_32 width, png_uint_32 height),PNG_EMPTY);
-#endif /* PNG_WRITE_APNG_SUPPORTED */
-#endif /* PNG_APNG_SUPPORTED */
-
/* Added at libpng version 1.6.0 */
#ifdef PNG_GAMMA_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
@@ -1916,7 +1793,7 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string, png_size_t size),PNG_EMPTY);
#endif /* pCAL || sCAL */
-#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
+#if defined(PNG_GAMMA_SUPPORTED) ||\
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
/* Added at libpng version 1.5.0 */
/* This is a utility to provide a*times/div (rounded) and indicate
@@ -2007,11 +1884,11 @@ typedef struct png_control * errors that might occur. Returns true on success, false on failure (either
* of the function or as a result of a png_error.)
*/
-PNG_INTERNAL_FUNCTION(void,png_safe_error,(png_structp png_ptr,
+PNG_INTERNAL_CALLBACK(void,png_safe_error,(png_structp png_ptr,
png_const_charp error_message),PNG_NORETURN);
#ifdef PNG_WARNINGS_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_safe_warning,(png_structp png_ptr,
+PNG_INTERNAL_CALLBACK(void,png_safe_warning,(png_structp png_ptr,
png_const_charp warning_message),PNG_EMPTY);
#else
# define png_safe_warning 0/*dummy argument*/
diff --git a/plugins/AdvaImg/src/LibPNG/pngread.c b/plugins/AdvaImg/src/LibPNG/pngread.c index 51ff8f3434..4b80ef2d46 100644 --- a/plugins/AdvaImg/src/LibPNG/pngread.c +++ b/plugins/AdvaImg/src/LibPNG/pngread.c @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file
*
- * Last changed in libpng 1.6.1 [March 28, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -158,9 +158,6 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr) else if (chunk_name == png_IDAT)
{
-#ifdef PNG_READ_APNG_SUPPORTED
- png_have_info(png_ptr, info_ptr);
-#endif
png_ptr->idat_size = length;
break;
}
@@ -250,17 +247,6 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr) png_handle_iTXt(png_ptr, info_ptr, length);
#endif
-#ifdef PNG_READ_APNG_SUPPORTED
- else if (chunk_name == png_acTL)
- png_handle_acTL(png_ptr, info_ptr, length);
-
- else if (chunk_name == png_fcTL)
- png_handle_fcTL(png_ptr, info_ptr, length);
-
- else if (chunk_name == png_fdAT)
- png_handle_fdAT(png_ptr, info_ptr, length);
-#endif
-
else
png_handle_unknown(png_ptr, info_ptr, length,
PNG_HANDLE_CHUNK_AS_DEFAULT);
@@ -268,72 +254,6 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr) }
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
-#ifdef PNG_READ_APNG_SUPPORTED
-void PNGAPI
-png_read_frame_head(png_structp png_ptr, png_infop info_ptr)
-{
- png_byte have_chunk_after_DAT; /* after IDAT or after fdAT */
-
- png_debug(0, "Reading frame head");
-
- if (!(png_ptr->mode & PNG_HAVE_acTL))
- png_error(png_ptr, "attempt to png_read_frame_head() but "
- "no acTL present");
-
- /* do nothing for the main IDAT */
- if (png_ptr->num_frames_read == 0)
- return;
-
- png_read_reset(png_ptr);
- png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
- png_ptr->mode &= ~PNG_HAVE_fcTL;
-
- have_chunk_after_DAT = 0;
- for (;;)
- {
- png_uint_32 length = png_read_chunk_header(png_ptr);
-
- if (png_ptr->chunk_name == png_IDAT)
- {
- /* discard trailing IDATs for the first frame */
- if (have_chunk_after_DAT || png_ptr->num_frames_read > 1)
- png_error(png_ptr, "png_read_frame_head(): out of place IDAT");
- png_crc_finish(png_ptr, length);
- }
-
- else if (png_ptr->chunk_name == png_fcTL)
- {
- png_handle_fcTL(png_ptr, info_ptr, length);
- have_chunk_after_DAT = 1;
- }
-
- else if (png_ptr->chunk_name == png_fdAT)
- {
- png_ensure_sequence_number(png_ptr, length);
-
- /* discard trailing fdATs for frames other than the first */
- if (!have_chunk_after_DAT && png_ptr->num_frames_read > 1)
- png_crc_finish(png_ptr, length - 4);
- else if(png_ptr->mode & PNG_HAVE_fcTL)
- {
- png_ptr->idat_size = length - 4;
- png_ptr->mode |= PNG_HAVE_IDAT;
-
- break;
- }
- else
- png_error(png_ptr, "png_read_frame_head(): out of place fdAT");
- }
- else
- {
- png_warning(png_ptr, "Skipped (ignored) a chunk "
- "between APNG chunks");
- png_crc_finish(png_ptr, length);
- }
- }
-}
-#endif /* PNG_READ_APNG_SUPPORTED */
-
/* Optional call to update the users info_ptr structure */
void PNGAPI
png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
@@ -385,6 +305,72 @@ png_start_read_image(png_structrp png_ptr) #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_MNG_FEATURES_SUPPORTED
+/* Undoes intrapixel differencing,
+ * NOTE: this is apparently only supported in the 'sequential' reader.
+ */
+static void
+png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
+{
+ png_debug(1, "in png_do_read_intrapixel");
+
+ if (
+ (row_info->color_type & PNG_COLOR_MASK_COLOR))
+ {
+ int bytes_per_pixel;
+ png_uint_32 row_width = row_info->width;
+
+ if (row_info->bit_depth == 8)
+ {
+ png_bytep rp;
+ png_uint_32 i;
+
+ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+ bytes_per_pixel = 3;
+
+ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ bytes_per_pixel = 4;
+
+ else
+ return;
+
+ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+ {
+ *(rp) = (png_byte)((256 + *rp + *(rp + 1)) & 0xff);
+ *(rp+2) = (png_byte)((256 + *(rp + 2) + *(rp + 1)) & 0xff);
+ }
+ }
+ else if (row_info->bit_depth == 16)
+ {
+ png_bytep rp;
+ png_uint_32 i;
+
+ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+ bytes_per_pixel = 6;
+
+ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ bytes_per_pixel = 8;
+
+ else
+ return;
+
+ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+ {
+ png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
+ png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
+ png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
+ png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
+ png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
+ *(rp ) = (png_byte)((red >> 8) & 0xff);
+ *(rp + 1) = (png_byte)(red & 0xff);
+ *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
+ *(rp + 5) = (png_byte)(blue & 0xff);
+ }
+ }
+ }
+}
+#endif /* PNG_MNG_FEATURES_SUPPORTED */
+
void PNGAPI
png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
{
@@ -569,7 +555,6 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row) }
#endif
-
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
if (png_ptr->transformations)
png_do_read_transformations(png_ptr, &row_info);
@@ -796,11 +781,14 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr) png_uint_32 length = png_read_chunk_header(png_ptr);
png_uint_32 chunk_name = png_ptr->chunk_name;
- if (chunk_name == png_IHDR)
+ if (chunk_name == png_IEND)
+ png_handle_IEND(png_ptr, info_ptr, length);
+
+ else if (chunk_name == png_IHDR)
png_handle_IHDR(png_ptr, info_ptr, length);
- else if (chunk_name == png_IEND)
- png_handle_IEND(png_ptr, info_ptr, length);
+ else if (info_ptr == NULL)
+ png_crc_finish(png_ptr, length);
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
@@ -1016,8 +1004,6 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr, int transforms,
voidp params)
{
- int row;
-
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -1029,126 +1015,149 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr, png_error(png_ptr, "Image is too high to process with png_read_png()");
/* -------------- image transformations start here ------------------- */
+ /* libpng 1.6.10: add code to cause a png_app_error if a selected TRANSFORM
+ * is not implemented. This will only happen in de-configured (non-default)
+ * libpng builds. The results can be unexpected - png_read_png may return
+ * short or mal-formed rows because the transform is skipped.
+ */
-#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
/* Tell libpng to strip 16-bit/color files down to 8 bits per color.
*/
if (transforms & PNG_TRANSFORM_SCALE_16)
- {
/* Added at libpng-1.5.4. "strip_16" produces the same result that it
* did in earlier versions, while "scale_16" is now more accurate.
*/
+#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
png_set_scale_16(png_ptr);
- }
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_SCALE_16 not supported");
#endif
-#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
/* If both SCALE and STRIP are required pngrtran will effectively cancel the
* latter by doing SCALE first. This is ok and allows apps not to check for
* which is supported to get the right answer.
*/
if (transforms & PNG_TRANSFORM_STRIP_16)
+#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
png_set_strip_16(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_STRIP_16 not supported");
#endif
-#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
/* Strip alpha bytes from the input data without combining with
* the background (not recommended).
*/
if (transforms & PNG_TRANSFORM_STRIP_ALPHA)
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
png_set_strip_alpha(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_STRIP_ALPHA not supported");
#endif
-#if defined(PNG_READ_PACK_SUPPORTED) && !defined(PNG_READ_EXPAND_SUPPORTED)
/* Extract multiple pixels with bit depths of 1, 2, or 4 from a single
* byte into separate bytes (useful for paletted and grayscale images).
*/
if (transforms & PNG_TRANSFORM_PACKING)
+#ifdef PNG_READ_PACK_SUPPORTED
png_set_packing(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_PACKING not supported");
#endif
-#ifdef PNG_READ_PACKSWAP_SUPPORTED
/* Change the order of packed pixels to least significant bit first
* (not useful if you are using png_set_packing).
*/
if (transforms & PNG_TRANSFORM_PACKSWAP)
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
png_set_packswap(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_PACKSWAP not supported");
#endif
-#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expand paletted colors into true RGB triplets
* Expand grayscale images to full 8 bits from 1, 2, or 4 bits/pixel
* Expand paletted or RGB images with transparency to full alpha
* channels so the data will be available as RGBA quartets.
*/
if (transforms & PNG_TRANSFORM_EXPAND)
- if ((png_ptr->bit_depth < 8) ||
- (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
- (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
- png_set_expand(png_ptr);
+#ifdef PNG_READ_EXPAND_SUPPORTED
+ png_set_expand(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_EXPAND not supported");
#endif
/* We don't handle background color or gamma transformation or quantizing.
*/
-#ifdef PNG_READ_INVERT_SUPPORTED
/* Invert monochrome files to have 0 as white and 1 as black
*/
if (transforms & PNG_TRANSFORM_INVERT_MONO)
+#ifdef PNG_READ_INVERT_SUPPORTED
png_set_invert_mono(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_MONO not supported");
#endif
-#ifdef PNG_READ_SHIFT_SUPPORTED
/* If you want to shift the pixel values from the range [0,255] or
* [0,65535] to the original [0,7] or [0,31], or whatever range the
* colors were originally in:
*/
- if ((transforms & PNG_TRANSFORM_SHIFT)
- && png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
- {
- png_color_8p sig_bit;
-
- png_get_sBIT(png_ptr, info_ptr, &sig_bit);
- png_set_shift(png_ptr, sig_bit);
- }
+ if (transforms & PNG_TRANSFORM_SHIFT)
+#ifdef PNG_READ_SHIFT_SUPPORTED
+ if (info_ptr->valid & PNG_INFO_sBIT)
+ png_set_shift(png_ptr, &info_ptr->sig_bit);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_SHIFT not supported");
#endif
-#ifdef PNG_READ_BGR_SUPPORTED
/* Flip the RGB pixels to BGR (or RGBA to BGRA) */
if (transforms & PNG_TRANSFORM_BGR)
+#ifdef PNG_READ_BGR_SUPPORTED
png_set_bgr(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_BGR not supported");
#endif
-#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
+#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
png_set_swap_alpha(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ALPHA not supported");
#endif
-#ifdef PNG_READ_SWAP_SUPPORTED
/* Swap bytes of 16-bit files to least significant byte first */
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
+#ifdef PNG_READ_SWAP_SUPPORTED
png_set_swap(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
#endif
/* Added at libpng-1.2.41 */
-#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel from opacity to transparency */
if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
png_set_invert_alpha(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_ALPHA not supported");
#endif
/* Added at libpng-1.2.41 */
-#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Expand grayscale image to RGB */
if (transforms & PNG_TRANSFORM_GRAY_TO_RGB)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
png_set_gray_to_rgb(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_GRAY_TO_RGB not supported");
#endif
/* Added at libpng-1.5.4 */
-#ifdef PNG_READ_EXPAND_16_SUPPORTED
if (transforms & PNG_TRANSFORM_EXPAND_16)
+#ifdef PNG_READ_EXPAND_16_SUPPORTED
png_set_expand_16(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_EXPAND_16 not supported");
#endif
/* We don't handle adding filler bytes */
@@ -1171,16 +1180,17 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr, {
png_uint_32 iptr;
- info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
- info_ptr->height * (sizeof (png_bytep)));
+ info_ptr->row_pointers = png_voidcast(png_bytepp, png_malloc(png_ptr,
+ info_ptr->height * (sizeof (png_bytep))));
+
for (iptr=0; iptr<info_ptr->height; iptr++)
info_ptr->row_pointers[iptr] = NULL;
info_ptr->free_me |= PNG_FREE_ROWS;
- for (row = 0; row < (int)info_ptr->height; row++)
- info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
- png_get_rowbytes(png_ptr, info_ptr));
+ for (iptr = 0; iptr < info_ptr->height; iptr++)
+ info_ptr->row_pointers[iptr] = png_voidcast(png_bytep,
+ png_malloc(png_ptr, info_ptr->rowbytes));
}
png_read_image(png_ptr, info_ptr->row_pointers);
@@ -1189,9 +1199,7 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr, /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
- PNG_UNUSED(transforms) /* Quiet compiler warnings */
PNG_UNUSED(params)
-
}
#endif /* PNG_INFO_IMAGE_SUPPORTED */
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
@@ -1205,12 +1213,11 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr, /* Arguments to png_image_finish_read: */
/* Encoding of PNG data (used by the color-map code) */
-/* TODO: change these, dang, ANSI-C reserves the 'E' namespace. */
-# define E_NOTSET 0 /* File encoding not yet known */
-# define E_sRGB 1 /* 8-bit encoded to sRGB gamma */
-# define E_LINEAR 2 /* 16-bit linear: not encoded, NOT pre-multiplied! */
-# define E_FILE 3 /* 8-bit encoded to file gamma, not sRGB or linear */
-# define E_LINEAR8 4 /* 8-bit linear: only from a file value */
+# define P_NOTSET 0 /* File encoding not yet known */
+# define P_sRGB 1 /* 8-bit encoded to sRGB gamma */
+# define P_LINEAR 2 /* 16-bit linear: not encoded, NOT pre-multiplied! */
+# define P_FILE 3 /* 8-bit encoded to file gamma, not sRGB or linear */
+# define P_LINEAR8 4 /* 8-bit linear: only from a file value */
/* Color-map processing: after libpng has run on the PNG image further
* processing may be needed to conver the data to color-map indicies.
@@ -1241,7 +1248,7 @@ typedef struct png_voidp first_row;
ptrdiff_t row_bytes; /* step between rows */
int file_encoding; /* E_ values above */
- png_fixed_point gamma_to_linear; /* For E_FILE, reciprocal of gamma */
+ png_fixed_point gamma_to_linear; /* For P_FILE, reciprocal of gamma */
int colormap_processing; /* PNG_CMAP_ values above */
} png_image_read_control;
@@ -1373,7 +1380,7 @@ png_image_read_header(png_voidp argument) #ifdef PNG_COLORSPACE_SUPPORTED
/* Does the colorspace match sRGB? If there is no color endpoint
* (colorant) information assume yes, otherwise require the
- * 'ENDPOINTS_MATCHE_sRGB' colorspace flag to have been set. If the
+ * 'ENDPOINTS_MATCHP_sRGB' colorspace flag to have been set. If the
* colorspace has been determined to be invalid ignore it.
*/
if ((format & PNG_FORMAT_FLAG_COLOR) != 0 && ((png_ptr->colorspace.flags
@@ -1562,17 +1569,24 @@ png_image_skip_unused_chunks(png_structrp png_ptr) *
* Or image data handling:
*
- * tRNS, bKGD, gAMA, cHRM, sRGB, iCCP and sBIT.
+ * tRNS, bKGD, gAMA, cHRM, sRGB, [iCCP] and sBIT.
*
* This provides a small performance improvement and eliminates any
* potential vulnerability to security problems in the unused chunks.
+ *
+ * At present the iCCP chunk data isn't used, so iCCP chunk can be ignored
+ * too. This allows the simplified API to be compiled without iCCP support,
+ * however if the support is there the chunk is still checked to detect
+ * errors (which are unfortunately quite common.)
*/
{
static PNG_CONST png_byte chunks_to_process[] = {
98, 75, 71, 68, '\0', /* bKGD */
99, 72, 82, 77, '\0', /* cHRM */
103, 65, 77, 65, '\0', /* gAMA */
+# ifdef PNG_READ_iCCP_SUPPORTED
105, 67, 67, 80, '\0', /* iCCP */
+# endif
115, 66, 73, 84, '\0', /* sBIT */
115, 82, 71, 66, '\0', /* sRGB */
};
@@ -1609,25 +1623,25 @@ set_file_encoding(png_image_read_control *display) {
if (png_gamma_not_sRGB(g))
{
- display->file_encoding = E_FILE;
+ display->file_encoding = P_FILE;
display->gamma_to_linear = png_reciprocal(g);
}
else
- display->file_encoding = E_sRGB;
+ display->file_encoding = P_sRGB;
}
else
- display->file_encoding = E_LINEAR8;
+ display->file_encoding = P_LINEAR8;
}
static unsigned int
decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding)
{
- if (encoding == E_FILE) /* double check */
+ if (encoding == P_FILE) /* double check */
encoding = display->file_encoding;
- if (encoding == E_NOTSET) /* must be the file encoding */
+ if (encoding == P_NOTSET) /* must be the file encoding */
{
set_file_encoding(display);
encoding = display->file_encoding;
@@ -1635,18 +1649,18 @@ decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding) switch (encoding)
{
- case E_FILE:
+ case P_FILE:
value = png_gamma_16bit_correct(value*257, display->gamma_to_linear);
break;
- case E_sRGB:
+ case P_sRGB:
value = png_sRGB_table[value];
break;
- case E_LINEAR:
+ case P_LINEAR:
break;
- case E_LINEAR8:
+ case P_LINEAR8:
value *= 257;
break;
@@ -1665,9 +1679,9 @@ png_colormap_compose(png_image_read_control *display, png_uint_32 background, int encoding)
{
/* The file value is composed on the background, the background has the given
- * encoding and so does the result, the file is encoded with E_FILE and the
+ * encoding and so does the result, the file is encoded with P_FILE and the
* file and alpha are 8-bit values. The (output) encoding will always be
- * E_LINEAR or E_sRGB.
+ * P_LINEAR or P_sRGB.
*/
png_uint_32 f = decode_gamma(display, foreground, foreground_encoding);
png_uint_32 b = decode_gamma(display, background, encoding);
@@ -1677,7 +1691,7 @@ png_colormap_compose(png_image_read_control *display, */
f = f * alpha + b * (255-alpha);
- if (encoding == E_LINEAR)
+ if (encoding == P_LINEAR)
{
/* Scale to 65535; divide by 255, approximately (in fact this is extremely
* accurate, it divides by 255.00000005937181414556, with no overflow.)
@@ -1687,13 +1701,13 @@ png_colormap_compose(png_image_read_control *display, f = (f+32768) >> 16;
}
- else /* E_sRGB */
+ else /* P_sRGB */
f = PNG_sRGB_FROM_LINEAR(f);
return f;
}
-/* NOTE: E_LINEAR values to this routine must be 16-bit, but E_FILE values must
+/* NOTE: P_LINEAR values to this routine must be 16-bit, but P_FILE values must
* be 8-bit.
*/
static void
@@ -1703,7 +1717,7 @@ png_create_colormap_entry(png_image_read_control *display, {
png_imagep image = display->image;
const int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) ?
- E_LINEAR : E_sRGB;
+ P_LINEAR : P_sRGB;
const int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 &&
(red != green || green != blue);
@@ -1713,18 +1727,18 @@ png_create_colormap_entry(png_image_read_control *display, /* Update the cache with whether the file gamma is significantly different
* from sRGB.
*/
- if (encoding == E_FILE)
+ if (encoding == P_FILE)
{
- if (display->file_encoding == E_NOTSET)
+ if (display->file_encoding == P_NOTSET)
set_file_encoding(display);
- /* Note that the cached value may be E_FILE too, but if it is then the
+ /* Note that the cached value may be P_FILE too, but if it is then the
* gamma_to_linear member has been set.
*/
encoding = display->file_encoding;
}
- if (encoding == E_FILE)
+ if (encoding == P_FILE)
{
png_fixed_point g = display->gamma_to_linear;
@@ -1732,10 +1746,10 @@ png_create_colormap_entry(png_image_read_control *display, green = png_gamma_16bit_correct(green*257, g);
blue = png_gamma_16bit_correct(blue*257, g);
- if (convert_to_Y || output_encoding == E_LINEAR)
+ if (convert_to_Y || output_encoding == P_LINEAR)
{
alpha *= 257;
- encoding = E_LINEAR;
+ encoding = P_LINEAR;
}
else
@@ -1743,11 +1757,11 @@ png_create_colormap_entry(png_image_read_control *display, red = PNG_sRGB_FROM_LINEAR(red * 255);
green = PNG_sRGB_FROM_LINEAR(green * 255);
blue = PNG_sRGB_FROM_LINEAR(blue * 255);
- encoding = E_sRGB;
+ encoding = P_sRGB;
}
}
- else if (encoding == E_LINEAR8)
+ else if (encoding == P_LINEAR8)
{
/* This encoding occurs quite frequently in test cases because PngSuite
* includes a gAMA 1.0 chunk with most images.
@@ -1756,10 +1770,10 @@ png_create_colormap_entry(png_image_read_control *display, green *= 257;
blue *= 257;
alpha *= 257;
- encoding = E_LINEAR;
+ encoding = P_LINEAR;
}
- else if (encoding == E_sRGB && (convert_to_Y || output_encoding == E_LINEAR))
+ else if (encoding == P_sRGB && (convert_to_Y || output_encoding == P_LINEAR))
{
/* The values are 8-bit sRGB values, but must be converted to 16-bit
* linear.
@@ -1768,11 +1782,11 @@ png_create_colormap_entry(png_image_read_control *display, green = png_sRGB_table[green];
blue = png_sRGB_table[blue];
alpha *= 257;
- encoding = E_LINEAR;
+ encoding = P_LINEAR;
}
/* This is set if the color isn't gray but the output is. */
- if (encoding == E_LINEAR)
+ if (encoding == P_LINEAR)
{
if (convert_to_Y)
{
@@ -1780,7 +1794,7 @@ png_create_colormap_entry(png_image_read_control *display, png_uint_32 y = (png_uint_32)6968 * red + (png_uint_32)23434 * green +
(png_uint_32)2366 * blue;
- if (output_encoding == E_LINEAR)
+ if (output_encoding == P_LINEAR)
y = (y + 16384) >> 15;
else
@@ -1789,19 +1803,19 @@ png_create_colormap_entry(png_image_read_control *display, y = (y + 128) >> 8;
y *= 255;
y = PNG_sRGB_FROM_LINEAR((y + 64) >> 7);
- encoding = E_sRGB;
+ encoding = P_sRGB;
}
blue = red = green = y;
}
- else if (output_encoding == E_sRGB)
+ else if (output_encoding == P_sRGB)
{
red = PNG_sRGB_FROM_LINEAR(red * 255);
green = PNG_sRGB_FROM_LINEAR(green * 255);
blue = PNG_sRGB_FROM_LINEAR(blue * 255);
alpha = PNG_DIV257(alpha);
- encoding = E_sRGB;
+ encoding = P_sRGB;
}
}
@@ -1810,7 +1824,7 @@ png_create_colormap_entry(png_image_read_control *display, /* Store the value. */
{
-# ifdef PNG_FORMAT_BGR_SUPPORTED
+# ifdef PNG_FORMAT_AFIRST_SUPPORTED
const int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
(image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
# else
@@ -1822,7 +1836,7 @@ png_create_colormap_entry(png_image_read_control *display, # define bgr 0
# endif
- if (output_encoding == E_LINEAR)
+ if (output_encoding == P_LINEAR)
{
png_uint_16p entry = png_voidcast(png_uint_16p, display->colormap);
@@ -1877,7 +1891,7 @@ png_create_colormap_entry(png_image_read_control *display, }
}
- else /* output encoding is E_sRGB */
+ else /* output encoding is P_sRGB */
{
png_bytep entry = png_voidcast(png_bytep, display->colormap);
@@ -1919,7 +1933,7 @@ make_gray_file_colormap(png_image_read_control *display) unsigned int i;
for (i=0; i<256; ++i)
- png_create_colormap_entry(display, i, i, i, i, 255, E_FILE);
+ png_create_colormap_entry(display, i, i, i, i, 255, P_FILE);
return i;
}
@@ -1930,7 +1944,7 @@ make_gray_colormap(png_image_read_control *display) unsigned int i;
for (i=0; i<256; ++i)
- png_create_colormap_entry(display, i, i, i, i, 255, E_sRGB);
+ png_create_colormap_entry(display, i, i, i, i, 255, P_sRGB);
return i;
}
@@ -1969,13 +1983,13 @@ make_ga_colormap(png_image_read_control *display) while (i < 231)
{
unsigned int gray = (i * 256 + 115) / 231;
- png_create_colormap_entry(display, i++, gray, gray, gray, 255, E_sRGB);
+ png_create_colormap_entry(display, i++, gray, gray, gray, 255, P_sRGB);
}
/* 255 is used here for the component values for consistency with the code
* that undoes premultiplication in pngwrite.c.
*/
- png_create_colormap_entry(display, i++, 255, 255, 255, 0, E_sRGB);
+ png_create_colormap_entry(display, i++, 255, 255, 255, 0, P_sRGB);
for (a=1; a<5; ++a)
{
@@ -1983,7 +1997,7 @@ make_ga_colormap(png_image_read_control *display) for (g=0; g<6; ++g)
png_create_colormap_entry(display, i++, g*51, g*51, g*51, a*51,
- E_sRGB);
+ P_sRGB);
}
return i;
@@ -2007,7 +2021,7 @@ make_rgb_colormap(png_image_read_control *display) for (b=0; b<6; ++b)
png_create_colormap_entry(display, i++, r*51, g*51, b*51, 255,
- E_sRGB);
+ P_sRGB);
}
}
@@ -2030,11 +2044,11 @@ png_image_read_colormap(png_voidp argument) const png_structrp png_ptr = image->opaque->png_ptr;
const png_uint_32 output_format = image->format;
const int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) ?
- E_LINEAR : E_sRGB;
+ P_LINEAR : P_sRGB;
unsigned int cmap_entries;
unsigned int output_processing; /* Output processing option */
- unsigned int data_encoding = E_NOTSET; /* Encoding libpng must produce */
+ unsigned int data_encoding = P_NOTSET; /* Encoding libpng must produce */
/* Background information; the background color and the index of this color
* in the color-map if it exists (else 256).
@@ -2054,7 +2068,7 @@ png_image_read_colormap(png_voidp argument) png_ptr->num_trans > 0) /* alpha in input */ &&
((output_format & PNG_FORMAT_FLAG_ALPHA) == 0) /* no alpha in output */)
{
- if (output_encoding == E_LINEAR) /* compose on black */
+ if (output_encoding == P_LINEAR) /* compose on black */
back_b = back_g = back_r = 0;
else if (display->background == NULL /* no way to remove it */)
@@ -2078,7 +2092,7 @@ png_image_read_colormap(png_voidp argument) }
}
- else if (output_encoding == E_LINEAR)
+ else if (output_encoding == P_LINEAR)
back_b = back_r = back_g = 65535;
else
@@ -2136,7 +2150,7 @@ png_image_read_colormap(png_voidp argument) trans = png_ptr->trans_color.gray;
if ((output_format & PNG_FORMAT_FLAG_ALPHA) == 0)
- back_alpha = output_encoding == E_LINEAR ? 65535 : 255;
+ back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
}
/* png_create_colormap_entry just takes an RGBA and writes the
@@ -2154,7 +2168,7 @@ png_image_read_colormap(png_voidp argument) */
if (i != trans)
png_create_colormap_entry(display, i, val, val, val, 255,
- E_FILE/*8-bit with file gamma*/);
+ P_FILE/*8-bit with file gamma*/);
/* Else this entry is transparent. The colors don't matter if
* there is an alpha channel (back_alpha == 0), but it does no
@@ -2170,7 +2184,7 @@ png_image_read_colormap(png_voidp argument) }
/* We need libpng to preserve the original encoding. */
- data_encoding = E_FILE;
+ data_encoding = P_FILE;
/* The rows from libpng, while technically gray values, are now also
* color-map indicies; however, they may need to be expanded to 1
@@ -2199,7 +2213,7 @@ png_image_read_colormap(png_voidp argument) * ensuring that the corresponding gray level matches the background
* color exactly.
*/
- data_encoding = E_sRGB;
+ data_encoding = P_sRGB;
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
png_error(png_ptr, "gray[16] color-map: too few entries");
@@ -2223,7 +2237,7 @@ png_image_read_colormap(png_voidp argument) png_color_16 c;
png_uint_32 gray = back_g;
- if (output_encoding == E_LINEAR)
+ if (output_encoding == P_LINEAR)
{
gray = PNG_sRGB_FROM_LINEAR(gray * 255);
@@ -2231,7 +2245,7 @@ png_image_read_colormap(png_voidp argument) * matches.
*/
png_create_colormap_entry(display, gray, back_g, back_g,
- back_g, 65535, E_LINEAR);
+ back_g, 65535, P_LINEAR);
}
/* The background passed to libpng, however, must be the
@@ -2252,7 +2266,7 @@ png_image_read_colormap(png_voidp argument) break;
}
- back_alpha = output_encoding == E_LINEAR ? 65535 : 255;
+ back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
}
/* output_processing means that the libpng-processed row will be
@@ -2289,7 +2303,7 @@ png_image_read_colormap(png_voidp argument) * worry about tRNS matching - tRNS is ignored if there is an alpha
* channel.
*/
- data_encoding = E_sRGB;
+ data_encoding = P_sRGB;
if (output_format & PNG_FORMAT_FLAG_ALPHA)
{
@@ -2332,13 +2346,13 @@ png_image_read_colormap(png_voidp argument) cmap_entries = make_gray_colormap(display);
- if (output_encoding == E_LINEAR)
+ if (output_encoding == P_LINEAR)
{
gray = PNG_sRGB_FROM_LINEAR(gray * 255);
/* And make sure the corresponding palette entry matches. */
png_create_colormap_entry(display, gray, back_g, back_g,
- back_g, 65535, E_LINEAR);
+ back_g, 65535, P_LINEAR);
}
/* The background passed to libpng, however, must be the sRGB
@@ -2369,7 +2383,7 @@ png_image_read_colormap(png_voidp argument) {
png_uint_32 gray = (i * 256 + 115) / 231;
png_create_colormap_entry(display, i++, gray, gray, gray,
- 255, E_sRGB);
+ 255, P_sRGB);
}
/* NOTE: this preserves the full precision of the application
@@ -2377,7 +2391,7 @@ png_image_read_colormap(png_voidp argument) */
background_index = i;
png_create_colormap_entry(display, i++, back_r, back_g, back_b,
- output_encoding == E_LINEAR ? 65535U : 255U, output_encoding);
+ output_encoding == P_LINEAR ? 65535U : 255U, output_encoding);
/* For non-opaque input composite on the sRGB background - this
* requires inverting the encoding for each component. The input
@@ -2387,7 +2401,7 @@ png_image_read_colormap(png_voidp argument) * represents. Consequently 'G' is always sRGB encoded, while
* 'A' is linear. We need the linear background colors.
*/
- if (output_encoding == E_sRGB) /* else already linear */
+ if (output_encoding == P_sRGB) /* else already linear */
{
/* This may produce a value not exactly matching the
* background, but that's ok because these numbers are only
@@ -2417,7 +2431,7 @@ png_image_read_colormap(png_voidp argument) png_create_colormap_entry(display, i++,
PNG_sRGB_FROM_LINEAR(gray + back_rx),
PNG_sRGB_FROM_LINEAR(gray + back_gx),
- PNG_sRGB_FROM_LINEAR(gray + back_bx), 255, E_sRGB);
+ PNG_sRGB_FROM_LINEAR(gray + back_bx), 255, P_sRGB);
}
}
@@ -2444,7 +2458,7 @@ png_image_read_colormap(png_voidp argument) */
png_set_rgb_to_gray_fixed(png_ptr, PNG_ERROR_ACTION_NONE, -1,
-1);
- data_encoding = E_sRGB;
+ data_encoding = P_sRGB;
/* The output will now be one or two 8-bit gray or gray+alpha
* channels. The more complex case arises when the input has alpha.
@@ -2489,7 +2503,7 @@ png_image_read_colormap(png_voidp argument) png_gamma_not_sRGB(png_ptr->colorspace.gamma))
{
cmap_entries = make_gray_file_colormap(display);
- data_encoding = E_FILE;
+ data_encoding = P_FILE;
}
else
@@ -2508,18 +2522,18 @@ png_image_read_colormap(png_voidp argument) * it. Achieve this simply by ensuring that the entry
* selected for the background really is the background color.
*/
- if (data_encoding == E_FILE) /* from the fixup above */
+ if (data_encoding == P_FILE) /* from the fixup above */
{
/* The app supplied a gray which is in output_encoding, we
- * need to convert it to a value of the input (E_FILE)
+ * need to convert it to a value of the input (P_FILE)
* encoding then set this palette entry to the required
* output encoding.
*/
- if (output_encoding == E_sRGB)
- gray = png_sRGB_table[gray]; /* now E_LINEAR */
+ if (output_encoding == P_sRGB)
+ gray = png_sRGB_table[gray]; /* now P_LINEAR */
gray = PNG_DIV257(png_gamma_16bit_correct(gray,
- png_ptr->colorspace.gamma)); /* now E_FILE */
+ png_ptr->colorspace.gamma)); /* now P_FILE */
/* And make sure the corresponding palette entry contains
* exactly the required sRGB value.
@@ -2528,14 +2542,14 @@ png_image_read_colormap(png_voidp argument) back_g, 0/*unused*/, output_encoding);
}
- else if (output_encoding == E_LINEAR)
+ else if (output_encoding == P_LINEAR)
{
gray = PNG_sRGB_FROM_LINEAR(gray * 255);
/* And make sure the corresponding palette entry matches.
*/
png_create_colormap_entry(display, gray, back_g, back_g,
- back_g, 0/*unused*/, E_LINEAR);
+ back_g, 0/*unused*/, P_LINEAR);
}
/* The background passed to libpng, however, must be the
@@ -2565,7 +2579,7 @@ png_image_read_colormap(png_voidp argument) * to do it once and using PNG_DIV51 on the 6x6x6 reduced RGB cube.
* Consequently we always want libpng to produce sRGB data.
*/
- data_encoding = E_sRGB;
+ data_encoding = P_sRGB;
/* Is there any transparency or alpha? */
if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
@@ -2585,7 +2599,7 @@ png_image_read_colormap(png_voidp argument) /* Add a transparent entry. */
png_create_colormap_entry(display, cmap_entries, 255, 255,
- 255, 0, E_sRGB);
+ 255, 0, P_sRGB);
/* This is stored as the background index for the processing
* algorithm.
@@ -2606,7 +2620,7 @@ png_image_read_colormap(png_voidp argument) */
for (b=0; b<256; b = (b << 1) | 0x7f)
png_create_colormap_entry(display, cmap_entries++,
- r, g, b, 128, E_sRGB);
+ r, g, b, 128, P_sRGB);
}
}
@@ -2635,7 +2649,7 @@ png_image_read_colormap(png_voidp argument) png_create_colormap_entry(display, cmap_entries, back_r,
back_g, back_b, 0/*unused*/, output_encoding);
- if (output_encoding == E_LINEAR)
+ if (output_encoding == P_LINEAR)
{
r = PNG_sRGB_FROM_LINEAR(back_r * 255);
g = PNG_sRGB_FROM_LINEAR(back_g * 255);
@@ -2675,11 +2689,11 @@ png_image_read_colormap(png_voidp argument) */
for (b=0; b<256; b = (b << 1) | 0x7f)
png_create_colormap_entry(display, cmap_entries++,
- png_colormap_compose(display, r, E_sRGB, 128,
+ png_colormap_compose(display, r, P_sRGB, 128,
back_r, output_encoding),
- png_colormap_compose(display, g, E_sRGB, 128,
+ png_colormap_compose(display, g, P_sRGB, 128,
back_g, output_encoding),
- png_colormap_compose(display, b, E_sRGB, 128,
+ png_colormap_compose(display, b, P_sRGB, 128,
back_b, output_encoding),
0/*unused*/, output_encoding);
}
@@ -2738,7 +2752,7 @@ png_image_read_colormap(png_voidp argument) num_trans = 0;
output_processing = PNG_CMAP_NONE;
- data_encoding = E_FILE; /* Don't change from color-map indicies */
+ data_encoding = P_FILE; /* Don't change from color-map indicies */
cmap_entries = png_ptr->num_palette;
if (cmap_entries > 256)
cmap_entries = 256;
@@ -2760,13 +2774,13 @@ png_image_read_colormap(png_voidp argument) * on the sRGB color in 'back'.
*/
png_create_colormap_entry(display, i,
- png_colormap_compose(display, colormap[i].red, E_FILE,
+ png_colormap_compose(display, colormap[i].red, P_FILE,
trans[i], back_r, output_encoding),
- png_colormap_compose(display, colormap[i].green, E_FILE,
+ png_colormap_compose(display, colormap[i].green, P_FILE,
trans[i], back_g, output_encoding),
- png_colormap_compose(display, colormap[i].blue, E_FILE,
+ png_colormap_compose(display, colormap[i].blue, P_FILE,
trans[i], back_b, output_encoding),
- output_encoding == E_LINEAR ? trans[i] * 257U :
+ output_encoding == P_LINEAR ? trans[i] * 257U :
trans[i],
output_encoding);
}
@@ -2775,7 +2789,7 @@ png_image_read_colormap(png_voidp argument) else
png_create_colormap_entry(display, i, colormap[i].red,
colormap[i].green, colormap[i].blue,
- i < num_trans ? trans[i] : 255U, E_FILE/*8-bit*/);
+ i < num_trans ? trans[i] : 255U, P_FILE/*8-bit*/);
}
/* The PNG data may have indicies packed in fewer than 8 bits, it
@@ -2803,12 +2817,12 @@ png_image_read_colormap(png_voidp argument) png_error(png_ptr, "bad data option (internal error)");
break;
- case E_sRGB:
+ case P_sRGB:
/* Change to 8-bit sRGB */
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
/* FALL THROUGH */
- case E_FILE:
+ case P_FILE:
if (png_ptr->bit_depth > 8)
png_set_scale_16(png_ptr);
break;
@@ -2885,7 +2899,6 @@ png_image_read_and_map(png_voidp argument) break;
default:
- passes = 0;
png_error(png_ptr, "unknown interlace type");
}
@@ -3204,7 +3217,6 @@ png_image_read_composite(png_voidp argument) break;
default:
- passes = 0;
png_error(png_ptr, "unknown interlace type");
}
@@ -3353,11 +3365,15 @@ png_image_read_background(png_voidp argument) break;
default:
- passes = 0;
png_error(png_ptr, "unknown interlace type");
}
- switch (png_get_bit_depth(png_ptr, info_ptr))
+ /* Use direct access to info_ptr here because otherwise the simplified API
+ * would require PNG_EASY_ACCESS_SUPPORTED (just for this.) Note this is
+ * checking the value after libpng expansions, not the original value in the
+ * PNG.
+ */
+ switch (info_ptr->bit_depth)
{
default:
png_error(png_ptr, "unexpected bit depth");
@@ -3365,7 +3381,7 @@ png_image_read_background(png_voidp argument) case 8:
/* 8-bit sRGB gray values with an alpha channel; the alpha channel is
- * to be removed by composing on a backgroundi: either the row if
+ * to be removed by composing on a background: either the row if
* display->background is NULL or display->background->green if not.
* Unlike the code above ALPHA_OPTIMIZED has *not* been done.
*/
@@ -3505,8 +3521,10 @@ png_image_read_background(png_voidp argument) unsigned int outchannels = 1+preserve_alpha;
int swap_alpha = 0;
- if (preserve_alpha && (image->format & PNG_FORMAT_FLAG_AFIRST))
- swap_alpha = 1;
+# ifdef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
+ if (preserve_alpha && (image->format & PNG_FORMAT_FLAG_AFIRST))
+ swap_alpha = 1;
+# endif
for (pass = 0; pass < passes; ++pass)
{
diff --git a/plugins/AdvaImg/src/LibPNG/pngrio.c b/plugins/AdvaImg/src/LibPNG/pngrio.c index 2b9c103202..6c02457a0c 100644 --- a/plugins/AdvaImg/src/LibPNG/pngrio.c +++ b/plugins/AdvaImg/src/LibPNG/pngrio.c @@ -1,8 +1,8 @@ /* pngrio.c - functions for data input
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.9 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -102,6 +102,7 @@ png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr, png_ptr->read_data_fn = read_data_fn;
#endif
+#ifdef PNG_WRITE_SUPPORTED
/* It is an error to write to a read device */
if (png_ptr->write_data_fn != NULL)
{
@@ -110,6 +111,7 @@ png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr, "Can't set both read_data_fn and write_data_fn in the"
" same structure");
}
+#endif
#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_ptr->output_flush_fn = NULL;
diff --git a/plugins/AdvaImg/src/LibPNG/pngrtran.c b/plugins/AdvaImg/src/LibPNG/pngrtran.c index 90698c598f..ae5deaeacc 100644 --- a/plugins/AdvaImg/src/LibPNG/pngrtran.c +++ b/plugins/AdvaImg/src/LibPNG/pngrtran.c @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers
*
- * Last changed in libpng 1.6.2 [April 25, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -1116,19 +1116,25 @@ png_init_palette_transformations(png_structrp png_ptr) /* Ignore if all the entries are opaque (unlikely!) */
for (i=0; i<png_ptr->num_trans; ++i)
+ {
if (png_ptr->trans_alpha[i] == 255)
continue;
else if (png_ptr->trans_alpha[i] == 0)
input_has_transparency = 1;
else
+ {
+ input_has_transparency = 1;
input_has_alpha = 1;
+ break;
+ }
+ }
}
/* If no alpha we can optimize. */
if (!input_has_alpha)
{
/* Any alpha means background and associative alpha processing is
- * required, however if the alpha is 0 or 1 throughout OPTIIMIZE_ALPHA
+ * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
* and ENCODE_ALPHA are irrelevant.
*/
png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
@@ -1193,7 +1199,7 @@ png_init_rgb_transformations(png_structrp png_ptr) if (!input_has_alpha)
{
/* Any alpha means background and associative alpha processing is
- * required, however if the alpha is 0 or 1 throughout OPTIIMIZE_ALPHA
+ * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
* and ENCODE_ALPHA are irrelevant.
*/
# ifdef PNG_READ_ALPHA_MODE_SUPPORTED
@@ -1357,12 +1363,12 @@ png_init_read_transformations(png_structrp png_ptr) * 12) PNG_EXPAND_16
* 13) PNG_GRAY_TO_RGB iff PNG_BACKGROUND_IS_GRAY
* 14) PNG_INVERT_MONO
- * 15) PNG_SHIFT
- * 16) PNG_PACK
- * 17) PNG_BGR
- * 18) PNG_PACKSWAP
- * 19) PNG_FILLER (includes PNG_ADD_ALPHA)
- * 20) PNG_INVERT_ALPHA
+ * 15) PNG_INVERT_ALPHA
+ * 16) PNG_SHIFT
+ * 17) PNG_PACK
+ * 18) PNG_BGR
+ * 19) PNG_PACKSWAP
+ * 20) PNG_FILLER (includes PNG_ADD_ALPHA)
* 21) PNG_SWAP_ALPHA
* 22) PNG_SWAP_BYTES
* 23) PNG_USER_TRANSFORM [must be last]
@@ -1878,31 +1884,34 @@ png_init_read_transformations(png_structrp png_ptr) * the number of significant bits is 0 then no shift is done (this is an
* error condition which is silently ignored.)
*/
- if (shift > 0 && shift < 8) for (i=0; i<istop; ++i)
- {
- int component = png_ptr->palette[i].red;
+ if (shift > 0 && shift < 8)
+ for (i=0; i<istop; ++i)
+ {
+ int component = png_ptr->palette[i].red;
- component >>= shift;
- png_ptr->palette[i].red = (png_byte)component;
- }
+ component >>= shift;
+ png_ptr->palette[i].red = (png_byte)component;
+ }
shift = 8 - png_ptr->sig_bit.green;
- if (shift > 0 && shift < 8) for (i=0; i<istop; ++i)
- {
- int component = png_ptr->palette[i].green;
+ if (shift > 0 && shift < 8)
+ for (i=0; i<istop; ++i)
+ {
+ int component = png_ptr->palette[i].green;
- component >>= shift;
- png_ptr->palette[i].green = (png_byte)component;
- }
+ component >>= shift;
+ png_ptr->palette[i].green = (png_byte)component;
+ }
shift = 8 - png_ptr->sig_bit.blue;
- if (shift > 0 && shift < 8) for (i=0; i<istop; ++i)
- {
- int component = png_ptr->palette[i].blue;
+ if (shift > 0 && shift < 8)
+ for (i=0; i<istop; ++i)
+ {
+ int component = png_ptr->palette[i].blue;
- component >>= shift;
- png_ptr->palette[i].blue = (png_byte)component;
- }
+ component >>= shift;
+ png_ptr->palette[i].blue = (png_byte)component;
+ }
}
#endif /* PNG_READ_SHIFT_SUPPORTED */
}
@@ -1933,6 +1942,9 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr) info_ptr->bit_depth = 8;
info_ptr->num_trans = 0;
+
+ if (png_ptr->palette == NULL)
+ png_error (png_ptr, "Palette is NULL in indexed image");
}
else
{
@@ -2111,303 +2123,6 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED) #endif
}
-/* Transform the row. The order of transformations is significant,
- * and is very touchy. If you add a transformation, take care to
- * decide how it fits in with the other transformations here.
- */
-void /* PRIVATE */
-png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
-{
- png_debug(1, "in png_do_read_transformations");
-
- if (png_ptr->row_buf == NULL)
- {
- /* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this
- * error is incredibly rare and incredibly easy to debug without this
- * information.
- */
- png_error(png_ptr, "NULL row buffer");
- }
-
- /* The following is debugging; prior to 1.5.4 the code was never compiled in;
- * in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
- * PNG_WARN_UNINITIALIZED_ROW removed. In 1.6 the new flag is set only for
- * all transformations, however in practice the ROW_INIT always gets done on
- * demand, if necessary.
- */
- if ((png_ptr->flags & PNG_FLAG_DETECT_UNINITIALIZED) != 0 &&
- !(png_ptr->flags & PNG_FLAG_ROW_INIT))
- {
- /* Application has failed to call either png_read_start_image() or
- * png_read_update_info() after setting transforms that expand pixels.
- * This check added to libpng-1.2.19 (but not enabled until 1.5.4).
- */
- png_error(png_ptr, "Uninitialized row");
- }
-
-#ifdef PNG_READ_EXPAND_SUPPORTED
- if (png_ptr->transformations & PNG_EXPAND)
- {
- if (row_info->color_type == PNG_COLOR_TYPE_PALETTE)
- {
- png_do_expand_palette(row_info, png_ptr->row_buf + 1,
- png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
- }
-
- else
- {
- if (png_ptr->num_trans &&
- (png_ptr->transformations & PNG_EXPAND_tRNS))
- png_do_expand(row_info, png_ptr->row_buf + 1,
- &(png_ptr->trans_color));
-
- else
- png_do_expand(row_info, png_ptr->row_buf + 1,
- NULL);
- }
- }
-#endif
-
-#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
- if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
- !(png_ptr->transformations & PNG_COMPOSE) &&
- (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
- row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
- png_do_strip_channel(row_info, png_ptr->row_buf + 1,
- 0 /* at_start == false, because SWAP_ALPHA happens later */);
-#endif
-
-#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
- if (png_ptr->transformations & PNG_RGB_TO_GRAY)
- {
- int rgb_error =
- png_do_rgb_to_gray(png_ptr, row_info,
- png_ptr->row_buf + 1);
-
- if (rgb_error)
- {
- png_ptr->rgb_to_gray_status=1;
- if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
- PNG_RGB_TO_GRAY_WARN)
- png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
-
- if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
- PNG_RGB_TO_GRAY_ERR)
- png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
- }
- }
-#endif
-
-/* From Andreas Dilger e-mail to png-implement, 26 March 1998:
- *
- * In most cases, the "simple transparency" should be done prior to doing
- * gray-to-RGB, or you will have to test 3x as many bytes to check if a
- * pixel is transparent. You would also need to make sure that the
- * transparency information is upgraded to RGB.
- *
- * To summarize, the current flow is:
- * - Gray + simple transparency -> compare 1 or 2 gray bytes and composite
- * with background "in place" if transparent,
- * convert to RGB if necessary
- * - Gray + alpha -> composite with gray background and remove alpha bytes,
- * convert to RGB if necessary
- *
- * To support RGB backgrounds for gray images we need:
- * - Gray + simple transparency -> convert to RGB + simple transparency,
- * compare 3 or 6 bytes and composite with
- * background "in place" if transparent
- * (3x compare/pixel compared to doing
- * composite with gray bkgrnd)
- * - Gray + alpha -> convert to RGB + alpha, composite with background and
- * remove alpha bytes (3x float
- * operations/pixel compared with composite
- * on gray background)
- *
- * Greg's change will do this. The reason it wasn't done before is for
- * performance, as this increases the per-pixel operations. If we would check
- * in advance if the background was gray or RGB, and position the gray-to-RGB
- * transform appropriately, then it would save a lot of work/time.
- */
-
-#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
- /* If gray -> RGB, do so now only if background is non-gray; else do later
- * for performance reasons
- */
- if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
- !(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
- png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
-#endif
-
-#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
- defined(PNG_READ_ALPHA_MODE_SUPPORTED)
- if (png_ptr->transformations & PNG_COMPOSE)
- png_do_compose(row_info, png_ptr->row_buf + 1, png_ptr);
-#endif
-
-#ifdef PNG_READ_GAMMA_SUPPORTED
- if ((png_ptr->transformations & PNG_GAMMA) &&
-#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
- /* Because RGB_TO_GRAY does the gamma transform. */
- !(png_ptr->transformations & PNG_RGB_TO_GRAY) &&
-#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
- defined(PNG_READ_ALPHA_MODE_SUPPORTED)
- /* Because PNG_COMPOSE does the gamma transform if there is something to
- * do (if there is an alpha channel or transparency.)
- */
- !((png_ptr->transformations & PNG_COMPOSE) &&
- ((png_ptr->num_trans != 0) ||
- (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) &&
-#endif
- /* Because png_init_read_transformations transforms the palette, unless
- * RGB_TO_GRAY will do the transform.
- */
- (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE))
- png_do_gamma(row_info, png_ptr->row_buf + 1, png_ptr);
-#endif
-
-#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
- if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
- (png_ptr->transformations & PNG_COMPOSE) &&
- (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
- row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
- png_do_strip_channel(row_info, png_ptr->row_buf + 1,
- 0 /* at_start == false, because SWAP_ALPHA happens later */);
-#endif
-
-#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
- if ((png_ptr->transformations & PNG_ENCODE_ALPHA) &&
- (row_info->color_type & PNG_COLOR_MASK_ALPHA))
- png_do_encode_alpha(row_info, png_ptr->row_buf + 1, png_ptr);
-#endif
-
-#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
- if (png_ptr->transformations & PNG_SCALE_16_TO_8)
- png_do_scale_16_to_8(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
- /* There is no harm in doing both of these because only one has any effect,
- * by putting the 'scale' option first if the app asks for scale (either by
- * calling the API or in a TRANSFORM flag) this is what happens.
- */
- if (png_ptr->transformations & PNG_16_TO_8)
- png_do_chop(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_QUANTIZE_SUPPORTED
- if (png_ptr->transformations & PNG_QUANTIZE)
- {
- png_do_quantize(row_info, png_ptr->row_buf + 1,
- png_ptr->palette_lookup, png_ptr->quantize_index);
-
- if (row_info->rowbytes == 0)
- png_error(png_ptr, "png_do_quantize returned rowbytes=0");
- }
-#endif /* PNG_READ_QUANTIZE_SUPPORTED */
-
-#ifdef PNG_READ_EXPAND_16_SUPPORTED
- /* Do the expansion now, after all the arithmetic has been done. Notice
- * that previous transformations can handle the PNG_EXPAND_16 flag if this
- * is efficient (particularly true in the case of gamma correction, where
- * better accuracy results faster!)
- */
- if (png_ptr->transformations & PNG_EXPAND_16)
- png_do_expand_16(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
- /* NOTE: moved here in 1.5.4 (from much later in this list.) */
- if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
- (png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
- png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_INVERT_SUPPORTED
- if (png_ptr->transformations & PNG_INVERT_MONO)
- png_do_invert(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_SHIFT_SUPPORTED
- if (png_ptr->transformations & PNG_SHIFT)
- png_do_unshift(row_info, png_ptr->row_buf + 1,
- &(png_ptr->shift));
-#endif
-
-#ifdef PNG_READ_PACK_SUPPORTED
- if (png_ptr->transformations & PNG_PACK)
- png_do_unpack(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
- /* Added at libpng-1.5.10 */
- if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
- png_ptr->num_palette_max >= 0)
- png_do_check_palette_indexes(png_ptr, row_info);
-#endif
-
-#ifdef PNG_READ_BGR_SUPPORTED
- if (png_ptr->transformations & PNG_BGR)
- png_do_bgr(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_PACKSWAP_SUPPORTED
- if (png_ptr->transformations & PNG_PACKSWAP)
- png_do_packswap(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_FILLER_SUPPORTED
- if (png_ptr->transformations & PNG_FILLER)
- png_do_read_filler(row_info, png_ptr->row_buf + 1,
- (png_uint_32)png_ptr->filler, png_ptr->flags);
-#endif
-
-#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
- if (png_ptr->transformations & PNG_INVERT_ALPHA)
- png_do_read_invert_alpha(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
- if (png_ptr->transformations & PNG_SWAP_ALPHA)
- png_do_read_swap_alpha(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_READ_16BIT_SUPPORTED
-#ifdef PNG_READ_SWAP_SUPPORTED
- if (png_ptr->transformations & PNG_SWAP_BYTES)
- png_do_swap(row_info, png_ptr->row_buf + 1);
-#endif
-#endif
-
-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
- if (png_ptr->transformations & PNG_USER_TRANSFORM)
- {
- if (png_ptr->read_user_transform_fn != NULL)
- (*(png_ptr->read_user_transform_fn)) /* User read transform function */
- (png_ptr, /* png_ptr */
- row_info, /* row_info: */
- /* png_uint_32 width; width of row */
- /* png_size_t rowbytes; number of bytes in row */
- /* png_byte color_type; color type of pixels */
- /* png_byte bit_depth; bit depth of samples */
- /* png_byte channels; number of channels (1-4) */
- /* png_byte pixel_depth; bits per pixel (depth*channels) */
- png_ptr->row_buf + 1); /* start of pixel data for row */
-#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
- if (png_ptr->user_transform_depth)
- row_info->bit_depth = png_ptr->user_transform_depth;
-
- if (png_ptr->user_transform_channels)
- row_info->channels = png_ptr->user_transform_channels;
-#endif
- row_info->pixel_depth = (png_byte)(row_info->bit_depth *
- row_info->channels);
-
- row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width);
- }
-#endif
-}
-
#ifdef PNG_READ_PACK_SUPPORTED
/* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel,
* without changing the actual values. Thus, if you had a row with
@@ -2415,7 +2130,7 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info) * the numbers 0 or 1. If you would rather they contain 0 and 255, use
* png_do_shift() after this.
*/
-void /* PRIVATE */
+static void
png_do_unpack(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_unpack");
@@ -2513,7 +2228,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row) * a row of bit depth 8, but only 5 are significant, this will shift
* the values back to 0 through 31.
*/
-void /* PRIVATE */
+static void
png_do_unshift(png_row_infop row_info, png_bytep row,
png_const_color_8p sig_bits)
{
@@ -2652,7 +2367,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
/* Scale rows of bit depth 16 down to 8 accurately */
-void /* PRIVATE */
+static void
png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_scale_16_to_8");
@@ -2710,7 +2425,7 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row) #endif
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
-void /* PRIVATE */
+static void
/* Simply discard the low byte. This was the default behavior prior
* to libpng-1.5.4.
*/
@@ -2738,7 +2453,7 @@ png_do_chop(png_row_infop row_info, png_bytep row) #endif
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
-void /* PRIVATE */
+static void
png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_read_swap_alpha");
@@ -2835,7 +2550,7 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row) #endif
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
-void /* PRIVATE */
+static void
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
{
png_uint_32 row_width;
@@ -2937,7 +2652,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row) #ifdef PNG_READ_FILLER_SUPPORTED
/* Add filler channel if we have RGB color */
-void /* PRIVATE */
+static void
png_do_read_filler(png_row_infop row_info, png_bytep row,
png_uint_32 filler, png_uint_32 flags)
{
@@ -3124,7 +2839,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row, #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Expand grayscale files to RGB, with or without alpha */
-void /* PRIVATE */
+static void
png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
{
png_uint_32 i;
@@ -3263,7 +2978,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) * calculated to make the sum 32768. This will result in different rounding
* to that used above.
*/
-int /* PRIVATE */
+static int
png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
{
@@ -3457,73 +3172,14 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row) return rgb_error;
}
#endif
-#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
-
-#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
-/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth
- * large of png_color. This lets grayscale images be treated as
- * paletted. Most useful for gamma correction and simplification
- * of code. This API is not used internally.
- */
-void PNGAPI
-png_build_grayscale_palette(int bit_depth, png_colorp palette)
-{
- int num_palette;
- int color_inc;
- int i;
- int v;
- png_debug(1, "in png_do_build_grayscale_palette");
-
- if (palette == NULL)
- return;
-
- switch (bit_depth)
- {
- case 1:
- num_palette = 2;
- color_inc = 0xff;
- break;
-
- case 2:
- num_palette = 4;
- color_inc = 0x55;
- break;
-
- case 4:
- num_palette = 16;
- color_inc = 0x11;
- break;
-
- case 8:
- num_palette = 256;
- color_inc = 1;
- break;
-
- default:
- num_palette = 0;
- color_inc = 0;
- break;
- }
-
- for (i = 0, v = 0; i < num_palette; i++, v += color_inc)
- {
- palette[i].red = (png_byte)v;
- palette[i].green = (png_byte)v;
- palette[i].blue = (png_byte)v;
- }
-}
-#endif
-
-
-#ifdef PNG_READ_TRANSFORMS_SUPPORTED
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
/* Replace any alpha or transparency with the supplied background color.
* "background" is already in the screen gamma, while "background_1" is
* at a gamma of 1.0. Paletted files have already been taken care of.
*/
-void /* PRIVATE */
+static void
png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
{
#ifdef PNG_READ_GAMMA_SUPPORTED
@@ -4263,7 +3919,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) * is 16, use gamma_16_table and gamma_shift. Build these with
* build_gamma_table().
*/
-void /* PRIVATE */
+static void
png_do_gamma(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
{
png_const_bytep gamma_table = png_ptr->gamma_table;
@@ -4464,7 +4120,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row, png_structrp png_ptr) * linear.) Called only with color types that have an alpha channel. Needs the
* from_1 tables.
*/
-void /* PRIVATE */
+static void
png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
{
png_uint_32 row_width = row_info->width;
@@ -4530,7 +4186,7 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr) /* Expands a palette row to an RGB or RGBA row depending
* upon whether you supply trans and num_trans.
*/
-void /* PRIVATE */
+static void
png_do_expand_palette(png_row_infop row_info, png_bytep row,
png_const_colorp palette, png_const_bytep trans_alpha, int num_trans)
{
@@ -4683,7 +4339,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, /* If the bit depth < 8, it is expanded to 8. Also, if the already
* expanded transparency value is supplied, an alpha channel is built.
*/
-void /* PRIVATE */
+static void
png_do_expand(png_row_infop row_info, png_bytep row,
png_const_color_16p trans_color)
{
@@ -4913,7 +4569,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, /* If the bit depth is 8 and the color type is not a palette type expand the
* whole row to 16 bits. Has no effect otherwise.
*/
-void /* PRIVATE */
+static void
png_do_expand_16(png_row_infop row_info, png_bytep row)
{
if (row_info->bit_depth == 8 &&
@@ -4941,7 +4597,7 @@ png_do_expand_16(png_row_infop row_info, png_bytep row) #endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED
-void /* PRIVATE */
+static void
png_do_quantize(png_row_infop row_info, png_bytep row,
png_const_bytep palette_lookup, png_const_bytep quantize_lookup)
{
@@ -5033,69 +4689,303 @@ png_do_quantize(png_row_infop row_info, png_bytep row, }
}
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
-#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
-#ifdef PNG_MNG_FEATURES_SUPPORTED
-/* Undoes intrapixel differencing */
+/* Transform the row. The order of transformations is significant,
+ * and is very touchy. If you add a transformation, take care to
+ * decide how it fits in with the other transformations here.
+ */
void /* PRIVATE */
-png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
+png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
{
- png_debug(1, "in png_do_read_intrapixel");
+ png_debug(1, "in png_do_read_transformations");
- if (
- (row_info->color_type & PNG_COLOR_MASK_COLOR))
+ if (png_ptr->row_buf == NULL)
{
- int bytes_per_pixel;
- png_uint_32 row_width = row_info->width;
+ /* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this
+ * error is incredibly rare and incredibly easy to debug without this
+ * information.
+ */
+ png_error(png_ptr, "NULL row buffer");
+ }
- if (row_info->bit_depth == 8)
- {
- png_bytep rp;
- png_uint_32 i;
+ /* The following is debugging; prior to 1.5.4 the code was never compiled in;
+ * in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
+ * PNG_WARN_UNINITIALIZED_ROW removed. In 1.6 the new flag is set only for
+ * all transformations, however in practice the ROW_INIT always gets done on
+ * demand, if necessary.
+ */
+ if ((png_ptr->flags & PNG_FLAG_DETECT_UNINITIALIZED) != 0 &&
+ !(png_ptr->flags & PNG_FLAG_ROW_INIT))
+ {
+ /* Application has failed to call either png_read_start_image() or
+ * png_read_update_info() after setting transforms that expand pixels.
+ * This check added to libpng-1.2.19 (but not enabled until 1.5.4).
+ */
+ png_error(png_ptr, "Uninitialized row");
+ }
- if (row_info->color_type == PNG_COLOR_TYPE_RGB)
- bytes_per_pixel = 3;
+#ifdef PNG_READ_EXPAND_SUPPORTED
+ if (png_ptr->transformations & PNG_EXPAND)
+ {
+ if (row_info->color_type == PNG_COLOR_TYPE_PALETTE)
+ {
+ png_do_expand_palette(row_info, png_ptr->row_buf + 1,
+ png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
+ }
- else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
- bytes_per_pixel = 4;
+ else
+ {
+ if (png_ptr->num_trans &&
+ (png_ptr->transformations & PNG_EXPAND_tRNS))
+ png_do_expand(row_info, png_ptr->row_buf + 1,
+ &(png_ptr->trans_color));
else
- return;
-
- for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
- {
- *(rp) = (png_byte)((256 + *rp + *(rp + 1)) & 0xff);
- *(rp+2) = (png_byte)((256 + *(rp + 2) + *(rp + 1)) & 0xff);
- }
+ png_do_expand(row_info, png_ptr->row_buf + 1,
+ NULL);
}
- else if (row_info->bit_depth == 16)
- {
- png_bytep rp;
- png_uint_32 i;
+ }
+#endif
- if (row_info->color_type == PNG_COLOR_TYPE_RGB)
- bytes_per_pixel = 6;
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+ if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
+ !(png_ptr->transformations & PNG_COMPOSE) &&
+ (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
+ row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
+ png_do_strip_channel(row_info, png_ptr->row_buf + 1,
+ 0 /* at_start == false, because SWAP_ALPHA happens later */);
+#endif
- else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
- bytes_per_pixel = 8;
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+ if (png_ptr->transformations & PNG_RGB_TO_GRAY)
+ {
+ int rgb_error =
+ png_do_rgb_to_gray(png_ptr, row_info,
+ png_ptr->row_buf + 1);
- else
- return;
+ if (rgb_error)
+ {
+ png_ptr->rgb_to_gray_status=1;
+ if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
+ PNG_RGB_TO_GRAY_WARN)
+ png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
- for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
- {
- png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
- png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
- png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
- png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
- png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
- *(rp ) = (png_byte)((red >> 8) & 0xff);
- *(rp + 1) = (png_byte)(red & 0xff);
- *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
- *(rp + 5) = (png_byte)(blue & 0xff);
- }
+ if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
+ PNG_RGB_TO_GRAY_ERR)
+ png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
}
}
+#endif
+
+/* From Andreas Dilger e-mail to png-implement, 26 March 1998:
+ *
+ * In most cases, the "simple transparency" should be done prior to doing
+ * gray-to-RGB, or you will have to test 3x as many bytes to check if a
+ * pixel is transparent. You would also need to make sure that the
+ * transparency information is upgraded to RGB.
+ *
+ * To summarize, the current flow is:
+ * - Gray + simple transparency -> compare 1 or 2 gray bytes and composite
+ * with background "in place" if transparent,
+ * convert to RGB if necessary
+ * - Gray + alpha -> composite with gray background and remove alpha bytes,
+ * convert to RGB if necessary
+ *
+ * To support RGB backgrounds for gray images we need:
+ * - Gray + simple transparency -> convert to RGB + simple transparency,
+ * compare 3 or 6 bytes and composite with
+ * background "in place" if transparent
+ * (3x compare/pixel compared to doing
+ * composite with gray bkgrnd)
+ * - Gray + alpha -> convert to RGB + alpha, composite with background and
+ * remove alpha bytes (3x float
+ * operations/pixel compared with composite
+ * on gray background)
+ *
+ * Greg's change will do this. The reason it wasn't done before is for
+ * performance, as this increases the per-pixel operations. If we would check
+ * in advance if the background was gray or RGB, and position the gray-to-RGB
+ * transform appropriately, then it would save a lot of work/time.
+ */
+
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+ /* If gray -> RGB, do so now only if background is non-gray; else do later
+ * for performance reasons
+ */
+ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
+ !(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
+ png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
+#endif
+
+#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
+ defined(PNG_READ_ALPHA_MODE_SUPPORTED)
+ if (png_ptr->transformations & PNG_COMPOSE)
+ png_do_compose(row_info, png_ptr->row_buf + 1, png_ptr);
+#endif
+
+#ifdef PNG_READ_GAMMA_SUPPORTED
+ if ((png_ptr->transformations & PNG_GAMMA) &&
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+ /* Because RGB_TO_GRAY does the gamma transform. */
+ !(png_ptr->transformations & PNG_RGB_TO_GRAY) &&
+#endif
+#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
+ defined(PNG_READ_ALPHA_MODE_SUPPORTED)
+ /* Because PNG_COMPOSE does the gamma transform if there is something to
+ * do (if there is an alpha channel or transparency.)
+ */
+ !((png_ptr->transformations & PNG_COMPOSE) &&
+ ((png_ptr->num_trans != 0) ||
+ (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) &&
+#endif
+ /* Because png_init_read_transformations transforms the palette, unless
+ * RGB_TO_GRAY will do the transform.
+ */
+ (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE))
+ png_do_gamma(row_info, png_ptr->row_buf + 1, png_ptr);
+#endif
+
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+ if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
+ (png_ptr->transformations & PNG_COMPOSE) &&
+ (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
+ row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
+ png_do_strip_channel(row_info, png_ptr->row_buf + 1,
+ 0 /* at_start == false, because SWAP_ALPHA happens later */);
+#endif
+
+#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
+ if ((png_ptr->transformations & PNG_ENCODE_ALPHA) &&
+ (row_info->color_type & PNG_COLOR_MASK_ALPHA))
+ png_do_encode_alpha(row_info, png_ptr->row_buf + 1, png_ptr);
+#endif
+
+#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+ if (png_ptr->transformations & PNG_SCALE_16_TO_8)
+ png_do_scale_16_to_8(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+ /* There is no harm in doing both of these because only one has any effect,
+ * by putting the 'scale' option first if the app asks for scale (either by
+ * calling the API or in a TRANSFORM flag) this is what happens.
+ */
+ if (png_ptr->transformations & PNG_16_TO_8)
+ png_do_chop(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_QUANTIZE_SUPPORTED
+ if (png_ptr->transformations & PNG_QUANTIZE)
+ {
+ png_do_quantize(row_info, png_ptr->row_buf + 1,
+ png_ptr->palette_lookup, png_ptr->quantize_index);
+
+ if (row_info->rowbytes == 0)
+ png_error(png_ptr, "png_do_quantize returned rowbytes=0");
+ }
+#endif /* PNG_READ_QUANTIZE_SUPPORTED */
+
+#ifdef PNG_READ_EXPAND_16_SUPPORTED
+ /* Do the expansion now, after all the arithmetic has been done. Notice
+ * that previous transformations can handle the PNG_EXPAND_16 flag if this
+ * is efficient (particularly true in the case of gamma correction, where
+ * better accuracy results faster!)
+ */
+ if (png_ptr->transformations & PNG_EXPAND_16)
+ png_do_expand_16(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+ /* NOTE: moved here in 1.5.4 (from much later in this list.) */
+ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
+ (png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
+ png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_INVERT_SUPPORTED
+ if (png_ptr->transformations & PNG_INVERT_MONO)
+ png_do_invert(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
+ if (png_ptr->transformations & PNG_INVERT_ALPHA)
+ png_do_read_invert_alpha(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_SHIFT_SUPPORTED
+ if (png_ptr->transformations & PNG_SHIFT)
+ png_do_unshift(row_info, png_ptr->row_buf + 1,
+ &(png_ptr->shift));
+#endif
+
+#ifdef PNG_READ_PACK_SUPPORTED
+ if (png_ptr->transformations & PNG_PACK)
+ png_do_unpack(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
+ /* Added at libpng-1.5.10 */
+ if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
+ png_ptr->num_palette_max >= 0)
+ png_do_check_palette_indexes(png_ptr, row_info);
+#endif
+
+#ifdef PNG_READ_BGR_SUPPORTED
+ if (png_ptr->transformations & PNG_BGR)
+ png_do_bgr(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
+ if (png_ptr->transformations & PNG_PACKSWAP)
+ png_do_packswap(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_FILLER_SUPPORTED
+ if (png_ptr->transformations & PNG_FILLER)
+ png_do_read_filler(row_info, png_ptr->row_buf + 1,
+ (png_uint_32)png_ptr->filler, png_ptr->flags);
+#endif
+
+#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
+ if (png_ptr->transformations & PNG_SWAP_ALPHA)
+ png_do_read_swap_alpha(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_16BIT_SUPPORTED
+#ifdef PNG_READ_SWAP_SUPPORTED
+ if (png_ptr->transformations & PNG_SWAP_BYTES)
+ png_do_swap(row_info, png_ptr->row_buf + 1);
+#endif
+#endif
+
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+ if (png_ptr->transformations & PNG_USER_TRANSFORM)
+ {
+ if (png_ptr->read_user_transform_fn != NULL)
+ (*(png_ptr->read_user_transform_fn)) /* User read transform function */
+ (png_ptr, /* png_ptr */
+ row_info, /* row_info: */
+ /* png_uint_32 width; width of row */
+ /* png_size_t rowbytes; number of bytes in row */
+ /* png_byte color_type; color type of pixels */
+ /* png_byte bit_depth; bit depth of samples */
+ /* png_byte channels; number of channels (1-4) */
+ /* png_byte pixel_depth; bits per pixel (depth*channels) */
+ png_ptr->row_buf + 1); /* start of pixel data for row */
+#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
+ if (png_ptr->user_transform_depth)
+ row_info->bit_depth = png_ptr->user_transform_depth;
+
+ if (png_ptr->user_transform_channels)
+ row_info->channels = png_ptr->user_transform_channels;
+#endif
+ row_info->pixel_depth = (png_byte)(row_info->bit_depth *
+ row_info->channels);
+
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width);
+ }
+#endif
}
-#endif /* PNG_MNG_FEATURES_SUPPORTED */
+
+#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
#endif /* PNG_READ_SUPPORTED */
diff --git a/plugins/AdvaImg/src/LibPNG/pngrutil.c b/plugins/AdvaImg/src/LibPNG/pngrutil.c index 1e7e0d6903..2079db54f7 100644 --- a/plugins/AdvaImg/src/LibPNG/pngrutil.c +++ b/plugins/AdvaImg/src/LibPNG/pngrutil.c @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.6.3 [July 18, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -227,10 +227,7 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip) }
else
- {
- png_chunk_benign_error(png_ptr, "CRC error");
- return (0);
- }
+ png_chunk_error(png_ptr, "CRC error");
return (1);
}
@@ -278,6 +275,10 @@ png_crc_error(png_structrp png_ptr) return (0);
}
+#if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
+ defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_READ_sCAL_SUPPORTED) ||\
+ defined(PNG_READ_sPLT_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) ||\
+ defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_SEQUENTIAL_READ_SUPPORTED)
/* Manage the read buffer; this simply reallocates the buffer if it is not small
* enough (or if it is not allocated). The routine returns a pointer to the
* buffer; if an error occurs and 'warn' is set the routine returns NULL, else
@@ -310,21 +311,17 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn) else if (warn < 2) /* else silent */
{
-#ifdef PNG_WARNINGS_SUPPORTED
if (warn)
png_chunk_warning(png_ptr, "insufficient memory to read chunk");
+
else
-#endif
- {
-#ifdef PNG_ERROR_TEXT_SUPPORTED
png_chunk_error(png_ptr, "insufficient memory to read chunk");
-#endif
- }
}
}
return buffer;
}
+#endif /* PNG_READ_iCCP|iTXt|pCAL|sCAL|sPLT|tEXt|zTXt|SEQUENTIAL_READ */
/* png_inflate_claim: claim the zstream for some nefarious purpose that involves
* decompression. Returns Z_OK on success, else a zlib error code. It checks
@@ -821,11 +818,6 @@ png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) filter_type = buf[11];
interlace_type = buf[12];
-#ifdef PNG_READ_APNG_SUPPORTED
- png_ptr->first_frame_width = width;
- png_ptr->first_frame_height = height;
-#endif
-
/* Set internal variables */
png_ptr->width = width;
png_ptr->height = height;
@@ -986,22 +978,15 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE))
{
if (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)
- {
- png_chunk_benign_error(png_ptr, "CRC error");
- }
+ return;
else
- {
- png_chunk_warning(png_ptr, "CRC error");
- return;
- }
+ png_chunk_error(png_ptr, "CRC error");
}
/* Otherwise, we (optionally) emit a warning and use the chunk. */
else if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN))
- {
png_chunk_warning(png_ptr, "CRC error");
- }
}
#endif
@@ -1112,13 +1097,12 @@ png_handle_gAMA(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) void /* PRIVATE */
png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
- unsigned int truelen;
+ unsigned int truelen, i;
+ png_byte sample_depth;
png_byte buf[4];
png_debug(1, "in png_handle_sBIT");
- buf[0] = buf[1] = buf[2] = buf[3] = 0;
-
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_chunk_error(png_ptr, "missing IHDR");
@@ -1137,10 +1121,16 @@ png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) }
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ {
truelen = 3;
+ sample_depth = 8;
+ }
else
+ {
truelen = png_ptr->channels;
+ sample_depth = png_ptr->bit_depth;
+ }
if (length != truelen || length > 4)
{
@@ -1149,11 +1139,19 @@ png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) return;
}
+ buf[0] = buf[1] = buf[2] = buf[3] = sample_depth;
png_crc_read(png_ptr, buf, truelen);
if (png_crc_finish(png_ptr, 0))
return;
+ for (i=0; i<truelen; ++i)
+ if (buf[i] == 0 || buf[i] > sample_depth)
+ {
+ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
if (png_ptr->color_type & PNG_COLOR_MASK_COLOR)
{
png_ptr->sig_bit.red = buf[0];
@@ -1423,7 +1421,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) (sizeof local_buffer), &length,
profile + (sizeof profile_header), &size, 0);
- /* Still expect a a buffer error because we expect
+ /* Still expect a buffer error because we expect
* there to be some tag data!
*/
if (size == 0)
@@ -2700,179 +2698,6 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) }
#endif
-#ifdef PNG_READ_APNG_SUPPORTED
-void /* PRIVATE */
-png_handle_acTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
-{
- png_byte data[8];
- png_uint_32 num_frames;
- png_uint_32 num_plays;
- png_uint_32 didSet;
-
- png_debug(1, "in png_handle_acTL");
-
- if (!(png_ptr->mode & PNG_HAVE_IHDR))
- {
- png_error(png_ptr, "Missing IHDR before acTL");
- }
- else if (png_ptr->mode & PNG_HAVE_IDAT)
- {
- png_warning(png_ptr, "Invalid acTL after IDAT skipped");
- png_crc_finish(png_ptr, length);
- return;
- }
- else if (png_ptr->mode & PNG_HAVE_acTL)
- {
- png_warning(png_ptr, "Duplicate acTL skipped");
- png_crc_finish(png_ptr, length);
- return;
- }
- else if (length != 8)
- {
- png_warning(png_ptr, "acTL with invalid length skipped");
- png_crc_finish(png_ptr, length);
- return;
- }
-
- png_crc_read(png_ptr, data, 8);
- png_crc_finish(png_ptr, 0);
-
- num_frames = png_get_uint_31(png_ptr, data);
- num_plays = png_get_uint_31(png_ptr, data + 4);
-
- /* the set function will do error checking on num_frames */
- didSet = png_set_acTL(png_ptr, info_ptr, num_frames, num_plays);
- if(didSet)
- png_ptr->mode |= PNG_HAVE_acTL;
-}
-
-void /* PRIVATE */
-png_handle_fcTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
-{
- png_byte data[22];
- 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_debug(1, "in png_handle_fcTL");
-
- png_ensure_sequence_number(png_ptr, length);
-
- if (!(png_ptr->mode & PNG_HAVE_IHDR))
- {
- png_error(png_ptr, "Missing IHDR before fcTL");
- }
- else if (png_ptr->mode & PNG_HAVE_IDAT)
- {
- /* for any frames other then the first this message may be misleading,
- * but correct. PNG_HAVE_IDAT is unset before the frame head is read
- * i can't think of a better message */
- png_warning(png_ptr, "Invalid fcTL after IDAT skipped");
- png_crc_finish(png_ptr, length-4);
- return;
- }
- else if (png_ptr->mode & PNG_HAVE_fcTL)
- {
- png_warning(png_ptr, "Duplicate fcTL within one frame skipped");
- png_crc_finish(png_ptr, length-4);
- return;
- }
- else if (length != 26)
- {
- png_warning(png_ptr, "fcTL with invalid length skipped");
- png_crc_finish(png_ptr, length-4);
- return;
- }
-
- png_crc_read(png_ptr, data, 22);
- png_crc_finish(png_ptr, 0);
-
- width = png_get_uint_31(png_ptr, data);
- height = png_get_uint_31(png_ptr, data + 4);
- x_offset = png_get_uint_31(png_ptr, data + 8);
- y_offset = png_get_uint_31(png_ptr, data + 12);
- delay_num = png_get_uint_16(data + 16);
- delay_den = png_get_uint_16(data + 18);
- dispose_op = data[20];
- blend_op = data[21];
-
- if (png_ptr->num_frames_read == 0 && (x_offset != 0 || y_offset != 0))
- {
- png_warning(png_ptr, "fcTL for the first frame must have zero offset");
- return;
- }
-
- if (info_ptr != NULL)
- {
- if (png_ptr->num_frames_read == 0 &&
- (width != info_ptr->width || height != info_ptr->height))
- {
- png_warning(png_ptr, "size in first frame's fcTL must match "
- "the size in IHDR");
- return;
- }
-
- /* The set function will do more error checking */
- png_set_next_frame_fcTL(png_ptr, info_ptr, width, height,
- x_offset, y_offset, delay_num, delay_den,
- dispose_op, blend_op);
-
- png_read_reinit(png_ptr, info_ptr);
-
- png_ptr->mode |= PNG_HAVE_fcTL;
- }
-}
-
-void /* PRIVATE */
-png_have_info(png_structp png_ptr, png_infop info_ptr)
-{
- if((info_ptr->valid & PNG_INFO_acTL) && !(info_ptr->valid & PNG_INFO_fcTL))
- {
- png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
- info_ptr->num_frames++;
- }
-}
-
-void /* PRIVATE */
-png_handle_fdAT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
-{
- png_ensure_sequence_number(png_ptr, length);
-
- /* This function is only called from png_read_end(), png_read_info(),
- * and png_push_read_chunk() which means that:
- * - the user doesn't want to read this frame
- * - or this is an out-of-place fdAT
- * in either case it is safe to ignore the chunk with a warning */
- png_warning(png_ptr, "ignoring fdAT chunk");
- png_crc_finish(png_ptr, length - 4);
- PNG_UNUSED(info_ptr)
-}
-
-void /* PRIVATE */
-png_ensure_sequence_number(png_structp png_ptr, png_uint_32 length)
-{
- png_byte data[4];
- png_uint_32 sequence_number;
-
- if (length < 4)
- png_error(png_ptr, "invalid fcTL or fdAT chunk found");
-
- png_crc_read(png_ptr, data, 4);
- sequence_number = png_get_uint_31(png_ptr, data);
-
- if (sequence_number != png_ptr->next_seq_num)
- png_error(png_ptr, "fcTL or fdAT chunk with out-of-order sequence "
- "number found");
-
- png_ptr->next_seq_num++;
-}
-#endif /* PNG_READ_APNG_SUPPORTED */
-
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
/* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
static int
@@ -3110,9 +2935,8 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, }
# endif
}
-# else /* no store support! */
+# else /* no store support: the chunk must be handled by the user callback */
PNG_UNUSED(info_ptr)
-# error untested code (reading unknown chunks with no store support)
# endif
/* Regardless of the error handling below the cached data (if any) can be
@@ -4050,7 +3874,6 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, if (pb < pa) pa = pb, a = b;
if (pc < pa) a = c;
- c = b;
a += *row;
*row++ = (png_byte)a;
}
@@ -4058,7 +3881,8 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, static void
png_init_filter_functions(png_structrp pp)
- /* This function is called once for every PNG image to set the
+ /* This function is called once for every PNG image (except for PNG images
+ * that only use PNG_FILTER_VALUE_NONE for all rows) to set the
* implementations required to reverse the filtering of PNG rows. Reversing
* the filter is the first transformation performed on the row data. It is
* performed in place, therefore an implementation can be selected based on
@@ -4100,10 +3924,13 @@ png_read_filter_row(png_structrp pp, png_row_infop row_info, png_bytep row, * PNG_FILTER_OPTIMIZATIONS to a function that overrides the generic
* implementations. See png_init_filter_functions above.
*/
- if (pp->read_filter[0] == NULL)
- png_init_filter_functions(pp);
if (filter > PNG_FILTER_VALUE_NONE && filter < PNG_FILTER_VALUE_LAST)
+ {
+ if (pp->read_filter[0] == NULL)
+ png_init_filter_functions(pp);
+
pp->read_filter[filter-1](row_info, row, prev_row);
+ }
}
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
@@ -4128,38 +3955,6 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output, uInt avail_in;
png_bytep buffer;
-#ifdef PNG_READ_APNG_SUPPORTED
- png_uint_32 bytes_to_skip = 0;
-
- while (png_ptr->idat_size == 0 || bytes_to_skip != 0)
- {
- png_crc_finish(png_ptr, bytes_to_skip);
- bytes_to_skip = 0;
-
- png_ptr->idat_size = png_read_chunk_header(png_ptr);
- if (png_ptr->num_frames_read == 0)
- {
- if (png_ptr->chunk_name != png_IDAT)
- png_error(png_ptr, "Not enough image data");
- }
- else
- {
- if (png_ptr->chunk_name == png_IEND)
- png_error(png_ptr, "Not enough image data");
- if (png_ptr->chunk_name != png_fdAT)
- {
- png_warning(png_ptr, "Skipped (ignored) a chunk "
- "between APNG chunks");
- bytes_to_skip = png_ptr->idat_size;
- continue;
- }
-
- png_ensure_sequence_number(png_ptr, png_ptr->idat_size);
-
- png_ptr->idat_size -= 4;
- }
- }
-#else
while (png_ptr->idat_size == 0)
{
png_crc_finish(png_ptr, 0);
@@ -4171,7 +3966,6 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output, if (png_ptr->chunk_name != png_IDAT)
png_error(png_ptr, "Not enough image data");
}
-#endif /* PNG_READ_APNG_SUPPORTED */
avail_in = png_ptr->IDAT_read_size;
@@ -4235,9 +4029,6 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output, png_ptr->mode |= PNG_AFTER_IDAT;
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
-#ifdef PNG_READ_APNG_SUPPORTED
- png_ptr->num_frames_read++;
-#endif
if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
png_chunk_benign_error(png_ptr, "Extra compressed data");
@@ -4683,80 +4474,4 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) png_ptr->flags |= PNG_FLAG_ROW_INIT;
}
-
-#ifdef PNG_READ_APNG_SUPPORTED
-/* This function is to be called after the main IDAT set has been read and
- * before a new IDAT is read. It resets some parts of png_ptr
- * to make them usable by the read functions again */
-void /* PRIVATE */
-png_read_reset(png_structp png_ptr)
-{
- png_ptr->mode &= ~PNG_HAVE_IDAT;
- png_ptr->mode &= ~PNG_AFTER_IDAT;
- png_ptr->row_number = 0;
- png_ptr->pass = 0;
-}
-
-void /* PRIVATE */
-png_read_reinit(png_structp png_ptr, png_infop info_ptr)
-{
- png_ptr->width = info_ptr->next_frame_width;
- png_ptr->height = info_ptr->next_frame_height;
- png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width);
- png_ptr->info_rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,
- png_ptr->width);
- if (png_ptr->prev_row)
- memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
-}
-
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-/* same as png_read_reset() but for the progressive reader */
-void /* PRIVATE */
-png_progressive_read_reset(png_structp png_ptr)
-{
-#ifdef PNG_READ_INTERLACING_SUPPORTED
- /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
-
- /* Start of interlace block */
- static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
-
- /* Offset to next interlace block */
- static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
-
- /* Start of interlace block in the y direction */
- static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
-
- /* Offset to next interlace block in the y direction */
- static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
-
- if (png_ptr->interlaced)
- {
- if (!(png_ptr->transformations & PNG_INTERLACE))
- png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
- png_pass_ystart[0]) / png_pass_yinc[0];
- else
- png_ptr->num_rows = png_ptr->height;
-
- png_ptr->iwidth = (png_ptr->width +
- png_pass_inc[png_ptr->pass] - 1 -
- png_pass_start[png_ptr->pass]) /
- png_pass_inc[png_ptr->pass];
- }
- else
-#endif /* PNG_READ_INTERLACING_SUPPORTED */
- {
- png_ptr->num_rows = png_ptr->height;
- png_ptr->iwidth = png_ptr->width;
- }
- png_ptr->flags &= ~PNG_FLAG_ZSTREAM_ENDED;
- if (inflateReset(&(png_ptr->zstream)) != Z_OK)
- png_error(png_ptr, "inflateReset failed");
- png_ptr->zstream.avail_in = 0;
- png_ptr->zstream.next_in = 0;
- png_ptr->zstream.next_out = png_ptr->row_buf;
- png_ptr->zstream.avail_out = (uInt)PNG_ROWBYTES(png_ptr->pixel_depth,
- png_ptr->iwidth) + 1;
-}
-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
-#endif /* PNG_READ_APNG_SUPPORTED */
#endif /* PNG_READ_SUPPORTED */
diff --git a/plugins/AdvaImg/src/LibPNG/pngset.c b/plugins/AdvaImg/src/LibPNG/pngset.c index 4f076c5951..6a7417a39c 100644 --- a/plugins/AdvaImg/src/LibPNG/pngset.c +++ b/plugins/AdvaImg/src/LibPNG/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct
*
- * Last changed in libpng 1.6.3 [July 18, 2013]
+ * Last changed in libpng 1.6.8 [December 19, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -239,11 +239,6 @@ png_set_IHDR(png_const_structrp png_ptr, png_inforp info_ptr, info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
-
-#ifdef PNG_APNG_SUPPORTED
- /* for non-animated png. this may be overwritten from an acTL chunk later */
- info_ptr->num_frames = 1;
-#endif
}
#ifdef PNG_oFFs_SUPPORTED
@@ -532,7 +527,7 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr, # endif
))
{
- png_chunk_report(png_ptr, "Invalid palette", PNG_CHUNK_ERROR);
+ png_error(png_ptr, "Invalid palette");
return;
}
@@ -1070,147 +1065,6 @@ png_set_sPLT(png_const_structrp png_ptr, }
#endif /* PNG_sPLT_SUPPORTED */
-#ifdef PNG_APNG_SUPPORTED
-png_uint_32 PNGAPI
-png_set_acTL(png_structp png_ptr, png_infop info_ptr,
- png_uint_32 num_frames, png_uint_32 num_plays)
-{
- png_debug1(1, "in %s storage function", "acTL");
-
- if (png_ptr == NULL || info_ptr == NULL)
- {
- png_warning(png_ptr,
- "Call to png_set_acTL() with NULL png_ptr "
- "or info_ptr ignored");
- return (0);
- }
- if (num_frames == 0)
- {
- png_warning(png_ptr,
- "Ignoring attempt to set acTL with num_frames zero");
- return (0);
- }
- if (num_frames > PNG_UINT_31_MAX)
- {
- png_warning(png_ptr,
- "Ignoring attempt to set acTL with num_frames > 2^31-1");
- return (0);
- }
- if (num_plays > PNG_UINT_31_MAX)
- {
- png_warning(png_ptr,
- "Ignoring attempt to set acTL with num_plays "
- "> 2^31-1");
- return (0);
- }
-
- info_ptr->num_frames = num_frames;
- info_ptr->num_plays = num_plays;
-
- info_ptr->valid |= PNG_INFO_acTL;
-
- return (1);
-}
-
-/* delay_num and delay_den can hold any 16-bit values including zero */
-png_uint_32 PNGAPI
-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_debug1(1, "in %s storage function", "fcTL");
-
- if (png_ptr == NULL || info_ptr == NULL)
- {
- png_warning(png_ptr,
- "Call to png_set_fcTL() with NULL png_ptr or info_ptr "
- "ignored");
- return (0);
- }
-
- png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
- delay_num, delay_den, dispose_op, blend_op);
-
- if (blend_op == PNG_BLEND_OP_OVER)
- {
- if (!(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) &&
- !(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
- {
- png_warning(png_ptr, "PNG_BLEND_OP_OVER is meaningless "
- "and wasteful for opaque images, ignored");
- blend_op = PNG_BLEND_OP_SOURCE;
- }
- }
-
- info_ptr->next_frame_width = width;
- info_ptr->next_frame_height = height;
- info_ptr->next_frame_x_offset = x_offset;
- info_ptr->next_frame_y_offset = y_offset;
- info_ptr->next_frame_delay_num = delay_num;
- info_ptr->next_frame_delay_den = delay_den;
- info_ptr->next_frame_dispose_op = dispose_op;
- info_ptr->next_frame_blend_op = blend_op;
-
- info_ptr->valid |= PNG_INFO_fcTL;
-
- return (1);
-}
-
-void /* PRIVATE */
-png_ensure_fcTL_is_valid(png_structp png_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)
-{
- if (width > PNG_UINT_31_MAX)
- png_error(png_ptr, "invalid width in fcTL (> 2^31-1)");
- if (height > PNG_UINT_31_MAX)
- png_error(png_ptr, "invalid height in fcTL (> 2^31-1)");
- if (x_offset > PNG_UINT_31_MAX)
- png_error(png_ptr, "invalid x_offset in fcTL (> 2^31-1)");
- if (y_offset > PNG_UINT_31_MAX)
- png_error(png_ptr, "invalid y_offset in fcTL (> 2^31-1)");
- if (width + x_offset > png_ptr->first_frame_width ||
- height + y_offset > png_ptr->first_frame_height)
- png_error(png_ptr, "dimensions of a frame are greater than"
- "the ones in IHDR");
-
- if (dispose_op != PNG_DISPOSE_OP_NONE &&
- dispose_op != PNG_DISPOSE_OP_BACKGROUND &&
- dispose_op != PNG_DISPOSE_OP_PREVIOUS)
- png_error(png_ptr, "invalid dispose_op in fcTL");
-
- if (blend_op != PNG_BLEND_OP_SOURCE &&
- blend_op != PNG_BLEND_OP_OVER)
- png_error(png_ptr, "invalid blend_op in fcTL");
-
- PNG_UNUSED(delay_num)
- PNG_UNUSED(delay_den)
-}
-
-png_uint_32 PNGAPI
-png_set_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr,
- png_byte is_hidden)
-{
- png_debug(1, "in png_first_frame_is_hidden()");
-
- if (png_ptr == NULL)
- return 0;
-
- if (is_hidden)
- png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
- else
- png_ptr->apng_flags &= ~PNG_FIRST_FRAME_HIDDEN;
-
- PNG_UNUSED(info_ptr)
-
- return 1;
-}
-#endif /* PNG_APNG_SUPPORTED */
-
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
static png_byte
check_location(png_const_structrp png_ptr, int location)
diff --git a/plugins/AdvaImg/src/LibPNG/pngstruct.h b/plugins/AdvaImg/src/LibPNG/pngstruct.h index 1d73b80c86..b6935534c5 100644 --- a/plugins/AdvaImg/src/LibPNG/pngstruct.h +++ b/plugins/AdvaImg/src/LibPNG/pngstruct.h @@ -409,27 +409,6 @@ struct png_struct_def png_byte filter_type;
#endif
-#ifdef PNG_APNG_SUPPORTED
- png_uint_32 apng_flags;
- png_uint_32 next_seq_num; /* next fcTL/fdAT chunk sequence number */
- png_uint_32 first_frame_width;
- png_uint_32 first_frame_height;
-
-#ifdef PNG_READ_APNG_SUPPORTED
- png_uint_32 num_frames_read; /* incremented after all image data of */
- /* a frame is read */
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
- png_progressive_frame_ptr frame_info_fn; /* frame info read callback */
- png_progressive_frame_ptr frame_end_fn; /* frame data read callback */
-#endif
-#endif
-
-#ifdef PNG_WRITE_APNG_SUPPORTED
- png_uint_32 num_frames_to_write;
- png_uint_32 num_frames_written;
-#endif
-#endif /* PNG_APNG_SUPPORTED */
-
/* New members added in libpng-1.2.0 */
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
diff --git a/plugins/AdvaImg/src/LibPNG/pngtest.c b/plugins/AdvaImg/src/LibPNG/pngtest.c index d92fade77f..7eeb0b8839 100644 --- a/plugins/AdvaImg/src/LibPNG/pngtest.c +++ b/plugins/AdvaImg/src/LibPNG/pngtest.c @@ -1,8 +1,8 @@ /* pngtest.c - a simple test program to test libpng
*
- * Last changed in libpng 1.6.2 [April 25, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.9 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -45,6 +45,11 @@ /* Known chunks that exist in pngtest.png must be supported or pngtest will fail
* simply as a result of re-ordering them. This may be fixed in 1.7
+ *
+ * pngtest allocates a single row buffer for each row and overwrites it,
+ * therefore if the write side doesn't support the writing of interlaced images
+ * nothing can be done for an interlaced image (and the code below will fail
+ * horribly trying to write extra data after writing garbage).
*/
#if defined PNG_READ_SUPPORTED && /* else nothing can be done */\
defined PNG_READ_bKGD_SUPPORTED &&\
@@ -58,9 +63,15 @@ defined PNG_READ_sRGB_SUPPORTED &&\
defined PNG_READ_tEXt_SUPPORTED &&\
defined PNG_READ_tIME_SUPPORTED &&\
- defined PNG_READ_zTXt_SUPPORTED
+ defined PNG_READ_zTXt_SUPPORTED &&\
+ defined PNG_WRITE_INTERLACING_SUPPORTED
+
+#ifdef PNG_ZLIB_HEADER
+# include PNG_ZLIB_HEADER /* defined by pnglibconf.h from 1.7 */
+#else
+# include "zlib.h"
+#endif
-#include "zlib.h"
/* Copied from pngpriv.h but only used in error messages below. */
#ifndef PNG_ZBUF_SIZE
# define PNG_ZBUF_SIZE 8192
@@ -116,10 +127,6 @@ static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */ static int error_count = 0; /* count calls to png_error */
static int warning_count = 0; /* count calls to png_warning */
-#ifdef __TURBOC__
-#include <mem.h>
-#endif
-
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
#ifndef png_jmpbuf
# define png_jmpbuf(png_ptr) png_ptr->jmpbuf
@@ -573,7 +580,8 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) /* We must free the list element too, but first kill
the memory that is to be freed. */
memset(ptr, 0x55, pinfo->size);
- png_free_default(png_ptr, pinfo);
+ if (pinfo)
+ free(pinfo);
pinfo = NULL;
break;
}
@@ -592,7 +600,8 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) if (verbose)
printf("Freeing %p\n", ptr);
- png_free_default(png_ptr, ptr);
+ if (ptr)
+ free(ptr);
ptr = NULL;
}
#endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */
@@ -658,8 +667,8 @@ set_location(png_structp png_ptr, struct user_chunk_data *data, int what) return 1; /* handled */
}
-static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr,
- png_unknown_chunkp chunk)
+static int PNGCBAPI
+read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk)
{
struct user_chunk_data *my_user_chunk_data =
(struct user_chunk_data*)png_get_user_chunk_ptr(png_ptr);
@@ -723,18 +732,18 @@ static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr, static void
write_sTER_chunk(png_structp write_ptr)
{
- png_byte png_sTER[5] = {115, 84, 69, 82, '\0'};
+ png_byte sTER[5] = {115, 84, 69, 82, '\0'};
if (verbose)
fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode);
- png_write_chunk(write_ptr, png_sTER, &user_chunk_data.sTER_mode, 1);
+ png_write_chunk(write_ptr, sTER, &user_chunk_data.sTER_mode, 1);
}
static void
write_vpAg_chunk(png_structp write_ptr)
{
- png_byte png_vpAg[5] = {118, 112, 65, 103, '\0'};
+ png_byte vpAg[5] = {118, 112, 65, 103, '\0'};
png_byte vpag_chunk_data[9];
@@ -747,7 +756,7 @@ write_vpAg_chunk(png_structp write_ptr) png_save_uint_32(vpag_chunk_data, user_chunk_data.vpAg_width);
png_save_uint_32(vpag_chunk_data + 4, user_chunk_data.vpAg_height);
vpag_chunk_data[8] = user_chunk_data.vpAg_units;
- png_write_chunk(write_ptr, png_vpAg, vpag_chunk_data, 9);
+ png_write_chunk(write_ptr, vpAg, vpag_chunk_data, 9);
}
static void
@@ -828,6 +837,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_structp write_ptr;
png_infop write_info_ptr;
png_infop write_end_info_ptr;
+ int interlace_preserved = 1;
#else
png_structp write_ptr = NULL;
png_infop write_info_ptr = NULL;
@@ -836,7 +846,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_bytep row_buf;
png_uint_32 y;
png_uint_32 width, height;
- int num_pass, pass;
+ int num_pass = 1, pass;
int bit_depth, color_type;
row_buf = NULL;
@@ -1042,10 +1052,26 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) &color_type, &interlace_type, &compression_type, &filter_type))
{
png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
-#ifdef PNG_WRITE_INTERLACING_SUPPORTED
color_type, interlace_type, compression_type, filter_type);
-#else
- color_type, PNG_INTERLACE_NONE, compression_type, filter_type);
+#ifndef PNG_READ_INTERLACING_SUPPORTED
+ /* num_pass will not be set below, set it here if the image is
+ * interlaced: what happens is that write interlacing is *not* turned
+ * on an the partial interlaced rows are written directly.
+ */
+ switch (interlace_type)
+ {
+ case PNG_INTERLACE_NONE:
+ num_pass = 1;
+ break;
+
+ case PNG_INTERLACE_ADAM7:
+ num_pass = 7;
+ break;
+
+ default:
+ png_error(read_ptr, "invalid interlace type");
+ /*NOT REACHED*/
+ }
#endif
}
}
@@ -1338,14 +1364,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif /* SINGLE_ROWBUF_ALLOC */
pngtest_debug("Writing row data");
-#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
- defined(PNG_WRITE_INTERLACING_SUPPORTED)
+#ifdef PNG_READ_INTERLACING_SUPPORTED
num_pass = png_set_interlace_handling(read_ptr);
-# ifdef PNG_WRITE_SUPPORTED
- png_set_interlace_handling(write_ptr);
-# endif
-#else
- num_pass = 1;
+ if (png_set_interlace_handling(write_ptr) != num_pass)
+ png_error(write_ptr, "png_set_interlace_handling: inconsistent num_pass");
#endif
#ifdef PNGTEST_TIMING
@@ -1391,11 +1413,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) }
}
-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
- png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
-#endif
-#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
- png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
+#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
+# ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+ png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
+# endif
+# ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
+ png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
+# endif
#endif
pngtest_debug("Reading and writing end_info data");
@@ -1575,15 +1599,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) }
#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
+ if (interlace_preserved) /* else the files will be changed */
{
- int wrote_question = 0;
-
for (;;)
{
+ static int wrote_question = 0;
png_size_t num_in, num_out;
char inbuf[256], outbuf[256];
-
num_in = fread(inbuf, 1, sizeof inbuf, fpin);
num_out = fread(outbuf, 1, sizeof outbuf, fpout);
@@ -1963,9 +1986,9 @@ main(void) fprintf(STDERR,
" test ignored because libpng was not built with read support\n");
/* And skip this test */
- return 77;
+ return PNG_LIBPNG_VER < 10600 ? 0 : 77;
}
#endif
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_3 Your_png_h_is_not_version_1_6_3;
+typedef png_libpng_version_1_6_10 Your_png_h_is_not_version_1_6_10;
diff --git a/plugins/AdvaImg/src/LibPNG/pngtrans.c b/plugins/AdvaImg/src/LibPNG/pngtrans.c index 99c6ea9d3b..4c88708a52 100644 --- a/plugins/AdvaImg/src/LibPNG/pngtrans.c +++ b/plugins/AdvaImg/src/LibPNG/pngtrans.c @@ -1,8 +1,8 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
- * Last changed in libpng 1.6.2 [April 25, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.9 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -57,7 +57,9 @@ png_set_packing(png_structrp png_ptr) if (png_ptr->bit_depth < 8)
{
png_ptr->transformations |= PNG_PACK;
- png_ptr->usr_bit_depth = 8;
+# ifdef PNG_WRITE_SUPPORTED
+ png_ptr->usr_bit_depth = 8;
+# endif
}
}
#endif
diff --git a/plugins/AdvaImg/src/LibPNG/pngwio.c b/plugins/AdvaImg/src/LibPNG/pngwio.c index c5fca989c8..5bc813832d 100644 --- a/plugins/AdvaImg/src/LibPNG/pngwio.c +++ b/plugins/AdvaImg/src/LibPNG/pngwio.c @@ -1,8 +1,8 @@ /* pngwio.c - functions for data output
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.9 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -149,8 +149,11 @@ png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr, # else
png_ptr->output_flush_fn = output_flush_fn;
# endif
+#else
+ PNG_UNUSED(output_flush_fn)
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
+#ifdef PNG_READ_SUPPORTED
/* It is an error to read while writing a png file */
if (png_ptr->read_data_fn != NULL)
{
@@ -160,5 +163,6 @@ png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr, "Can't set both read_data_fn and write_data_fn in the"
" same structure");
}
+#endif
}
#endif /* PNG_WRITE_SUPPORTED */
diff --git a/plugins/AdvaImg/src/LibPNG/pngwrite.c b/plugins/AdvaImg/src/LibPNG/pngwrite.c index 8a27cfc53c..a75d6fd2be 100644 --- a/plugins/AdvaImg/src/LibPNG/pngwrite.c +++ b/plugins/AdvaImg/src/LibPNG/pngwrite.c @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.6.2 [April 25, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -127,10 +127,6 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr) * application continues writing the PNG. So check the 'invalid' flag here
* too.
*/
-#ifdef PNG_WRITE_APNG_SUPPORTED
- if (info_ptr->valid & PNG_INFO_acTL)
- png_write_acTL(png_ptr, info_ptr->num_frames, info_ptr->num_plays);
-#endif
#ifdef PNG_GAMMA_SUPPORTED
# ifdef PNG_WRITE_gAMA_SUPPORTED
if (!(info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) &&
@@ -356,11 +352,6 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) if (!(png_ptr->mode & PNG_HAVE_IDAT))
png_error(png_ptr, "No IDATs written into file");
-#ifdef PNG_WRITE_APNG_SUPPORTED
- if (png_ptr->num_frames_written != png_ptr->num_frames_to_write)
- png_error(png_ptr, "Not enough frames written");
-#endif
-
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
if (png_ptr->num_palette_max > png_ptr->num_palette)
png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
@@ -616,6 +607,71 @@ png_write_image(png_structrp png_ptr, png_bytepp image) }
}
+#ifdef PNG_MNG_FEATURES_SUPPORTED
+/* Performs intrapixel differencing */
+static void
+png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
+{
+ png_debug(1, "in png_do_write_intrapixel");
+
+ if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
+ {
+ int bytes_per_pixel;
+ png_uint_32 row_width = row_info->width;
+ if (row_info->bit_depth == 8)
+ {
+ png_bytep rp;
+ png_uint_32 i;
+
+ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+ bytes_per_pixel = 3;
+
+ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ bytes_per_pixel = 4;
+
+ else
+ return;
+
+ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+ {
+ *(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
+ *(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
+ }
+ }
+
+#ifdef PNG_WRITE_16BIT_SUPPORTED
+ else if (row_info->bit_depth == 16)
+ {
+ png_bytep rp;
+ png_uint_32 i;
+
+ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+ bytes_per_pixel = 6;
+
+ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ bytes_per_pixel = 8;
+
+ else
+ return;
+
+ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+ {
+ png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
+ png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
+ png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
+ png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
+ png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
+ *(rp ) = (png_byte)((red >> 8) & 0xff);
+ *(rp + 1) = (png_byte)(red & 0xff);
+ *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
+ *(rp + 5) = (png_byte)(blue & 0xff);
+ }
+ }
+#endif /* PNG_WRITE_16BIT_SUPPORTED */
+ }
+}
+#endif /* PNG_MNG_FEATURES_SUPPORTED */
+
/* Called by user to write a row of image data */
void PNGAPI
png_write_row(png_structrp png_ptr, png_const_bytep row)
@@ -1490,81 +1546,117 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr, if (png_ptr == NULL || info_ptr == NULL)
return;
+ if ((info_ptr->valid & PNG_INFO_IDAT) == 0)
+ {
+ png_app_error(png_ptr, "no rows for png_write_image to write");
+ return;
+ }
+
/* Write the file header information. */
png_write_info(png_ptr, info_ptr);
/* ------ these transformations don't touch the info structure ------- */
-#ifdef PNG_WRITE_INVERT_SUPPORTED
/* Invert monochrome pixels */
if (transforms & PNG_TRANSFORM_INVERT_MONO)
+#ifdef PNG_WRITE_INVERT_SUPPORTED
png_set_invert_mono(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_MONO not supported");
#endif
-#ifdef PNG_WRITE_SHIFT_SUPPORTED
/* Shift the pixels up to a legal bit depth and fill in
* as appropriate to correctly scale the image.
*/
- if ((transforms & PNG_TRANSFORM_SHIFT)
- && (info_ptr->valid & PNG_INFO_sBIT))
- png_set_shift(png_ptr, &info_ptr->sig_bit);
+ if (transforms & PNG_TRANSFORM_SHIFT)
+#ifdef PNG_WRITE_SHIFT_SUPPORTED
+ if (info_ptr->valid & PNG_INFO_sBIT)
+ png_set_shift(png_ptr, &info_ptr->sig_bit);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_SHIFT not supported");
#endif
-#ifdef PNG_WRITE_PACK_SUPPORTED
/* Pack pixels into bytes */
if (transforms & PNG_TRANSFORM_PACKING)
- png_set_packing(png_ptr);
+#ifdef PNG_WRITE_PACK_SUPPORTED
+ png_set_packing(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_PACKING not supported");
#endif
-#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
/* Swap location of alpha bytes from ARGB to RGBA */
if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
+#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
png_set_swap_alpha(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ALPHA not supported");
#endif
+ /* Remove a filler (X) from XRGB/RGBX/AG/GA into to convert it into
+ * RGB, note that the code expects the input color type to be G or RGB; no
+ * alpha channel.
+ */
+ if (transforms &
+ (PNG_TRANSFORM_STRIP_FILLER_AFTER|PNG_TRANSFORM_STRIP_FILLER_BEFORE))
+ {
#ifdef PNG_WRITE_FILLER_SUPPORTED
- /* Pack XRGB/RGBX/ARGB/RGBA into RGB (4 channels -> 3 channels) */
- if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER)
- png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
+ if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER)
+ {
+ if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE)
+ png_app_error(png_ptr,
+ "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
+
+ /* Continue if ignored - this is the pre-1.6.10 behavior */
+ png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
+ }
- else if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE)
- png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
+ else if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE)
+ png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_STRIP_FILLER not supported");
#endif
+ }
-#ifdef PNG_WRITE_BGR_SUPPORTED
/* Flip BGR pixels to RGB */
if (transforms & PNG_TRANSFORM_BGR)
+#ifdef PNG_WRITE_BGR_SUPPORTED
png_set_bgr(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_BGR not supported");
#endif
-#ifdef PNG_WRITE_SWAP_SUPPORTED
/* Swap bytes of 16-bit files to most significant byte first */
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
+#ifdef PNG_WRITE_SWAP_SUPPORTED
png_set_swap(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
#endif
-#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
/* Swap bits of 1, 2, 4 bit packed pixel formats */
if (transforms & PNG_TRANSFORM_PACKSWAP)
+#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
png_set_packswap(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_PACKSWAP not supported");
#endif
-#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel from opacity to transparency */
if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
png_set_invert_alpha(png_ptr);
+#else
+ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_ALPHA not supported");
#endif
/* ----------------------- end of transformations ------------------- */
/* Write the bits */
- if (info_ptr->valid & PNG_INFO_IDAT)
- png_write_image(png_ptr, info_ptr->row_pointers);
+ png_write_image(png_ptr, info_ptr->row_pointers);
/* It is REQUIRED to call this to finish writing the rest of the file */
png_write_end(png_ptr, info_ptr);
- PNG_UNUSED(transforms) /* Quiet compiler warnings */
PNG_UNUSED(params)
}
#endif
@@ -1647,14 +1739,16 @@ png_write_image_16bit(png_voidp argument) if (image->format & PNG_FORMAT_FLAG_ALPHA)
{
- if (image->format & PNG_FORMAT_FLAG_AFIRST)
- {
- aindex = -1;
- ++input_row; /* To point to the first component */
- ++output_row;
- }
+# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
+ if (image->format & PNG_FORMAT_FLAG_AFIRST)
+ {
+ aindex = -1;
+ ++input_row; /* To point to the first component */
+ ++output_row;
+ }
- else
+ else
+# endif
aindex = channels;
}
@@ -1803,14 +1897,16 @@ png_write_image_8bit(png_voidp argument) png_bytep row_end;
int aindex;
- if (image->format & PNG_FORMAT_FLAG_AFIRST)
- {
- aindex = -1;
- ++input_row; /* To point to the first component */
- ++output_row;
- }
+# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
+ if (image->format & PNG_FORMAT_FLAG_AFIRST)
+ {
+ aindex = -1;
+ ++input_row; /* To point to the first component */
+ ++output_row;
+ }
- else
+ else
+# endif
aindex = channels;
/* Use row_end in place of a loop counter: */
@@ -1890,7 +1986,8 @@ png_image_set_PLTE(png_image_write_control *display) const png_uint_32 format = image->format;
const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
-# ifdef PNG_FORMAT_BGR_SUPPORTED
+# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
+ defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
const int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
(format & PNG_FORMAT_FLAG_ALPHA) != 0;
# else
@@ -2336,42 +2433,4 @@ png_image_write_to_file(png_imagep image, const char *file_name, }
#endif /* PNG_STDIO_SUPPORTED */
#endif /* SIMPLIFIED_WRITE */
-
-#ifdef PNG_WRITE_APNG_SUPPORTED
-void PNGAPI
-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_debug(1, "in png_write_frame_head");
-
- /* there is a chance this has been set after png_write_info was called,
- * so it would be set but not written. is there a way to be sure? */
- if (!(info_ptr->valid & PNG_INFO_acTL))
- png_error(png_ptr, "png_write_frame_head(): acTL not set");
-
- png_write_reset(png_ptr);
-
- png_write_reinit(png_ptr, info_ptr, width, height);
-
- if ( !(png_ptr->num_frames_written == 0 &&
- (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) ) )
- png_write_fcTL(png_ptr, width, height, x_offset, y_offset,
- delay_num, delay_den, dispose_op, blend_op);
-
- PNG_UNUSED(row_pointers)
-}
-
-void PNGAPI
-png_write_frame_tail(png_structp png_ptr, png_infop info_ptr)
-{
- png_debug(1, "in png_write_frame_tail");
-
- png_ptr->num_frames_written++;
-
- PNG_UNUSED(info_ptr)
-}
-#endif /* PNG_WRITE_APNG_SUPPORTED */
#endif /* PNG_WRITE_SUPPORTED */
diff --git a/plugins/AdvaImg/src/LibPNG/pngwtran.c b/plugins/AdvaImg/src/LibPNG/pngwtran.c index 2cdd7c95c2..03eabf0b0b 100644 --- a/plugins/AdvaImg/src/LibPNG/pngwtran.c +++ b/plugins/AdvaImg/src/LibPNG/pngwtran.c @@ -1,8 +1,8 @@ /* pngwtran.c - transforms the data in a row for PNG writers
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.9 [February 6, 2014]
+ * Copyright (c) 1998-2014 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,90 +14,14 @@ #include "pngpriv.h"
#ifdef PNG_WRITE_SUPPORTED
-
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
-/* Transform the data according to the user's wishes. The order of
- * transformations is significant.
- */
-void /* PRIVATE */
-png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
-{
- png_debug(1, "in png_do_write_transformations");
-
- if (png_ptr == NULL)
- return;
-
-#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
- if (png_ptr->transformations & PNG_USER_TRANSFORM)
- if (png_ptr->write_user_transform_fn != NULL)
- (*(png_ptr->write_user_transform_fn)) /* User write transform
- function */
- (png_ptr, /* png_ptr */
- row_info, /* row_info: */
- /* png_uint_32 width; width of row */
- /* png_size_t rowbytes; number of bytes in row */
- /* png_byte color_type; color type of pixels */
- /* png_byte bit_depth; bit depth of samples */
- /* png_byte channels; number of channels (1-4) */
- /* png_byte pixel_depth; bits per pixel (depth*channels) */
- png_ptr->row_buf + 1); /* start of pixel data for row */
-#endif
-
-#ifdef PNG_WRITE_FILLER_SUPPORTED
- if (png_ptr->transformations & PNG_FILLER)
- png_do_strip_channel(row_info, png_ptr->row_buf + 1,
- !(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
-#endif
-
-#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
- if (png_ptr->transformations & PNG_PACKSWAP)
- png_do_packswap(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_WRITE_PACK_SUPPORTED
- if (png_ptr->transformations & PNG_PACK)
- png_do_pack(row_info, png_ptr->row_buf + 1,
- (png_uint_32)png_ptr->bit_depth);
-#endif
-
-#ifdef PNG_WRITE_SWAP_SUPPORTED
- if (png_ptr->transformations & PNG_SWAP_BYTES)
- png_do_swap(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_WRITE_SHIFT_SUPPORTED
- if (png_ptr->transformations & PNG_SHIFT)
- png_do_shift(row_info, png_ptr->row_buf + 1,
- &(png_ptr->shift));
-#endif
-
-#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
- if (png_ptr->transformations & PNG_SWAP_ALPHA)
- png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
- if (png_ptr->transformations & PNG_INVERT_ALPHA)
- png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_WRITE_BGR_SUPPORTED
- if (png_ptr->transformations & PNG_BGR)
- png_do_bgr(row_info, png_ptr->row_buf + 1);
-#endif
-
-#ifdef PNG_WRITE_INVERT_SUPPORTED
- if (png_ptr->transformations & PNG_INVERT_MONO)
- png_do_invert(row_info, png_ptr->row_buf + 1);
-#endif
-}
#ifdef PNG_WRITE_PACK_SUPPORTED
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
* row_info bit depth should be 8 (one pixel per byte). The channels
* should be 1 (this only happens on grayscale and paletted images).
*/
-void /* PRIVATE */
+static void
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{
png_debug(1, "in png_do_pack");
@@ -242,7 +166,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) * would pass 3 as bit_depth, and this routine would translate the
* data to 0 to 15.
*/
-void /* PRIVATE */
+static void
png_do_shift(png_row_infop row_info, png_bytep row,
png_const_color_8p bit_depth)
{
@@ -381,7 +305,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, #endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
-void /* PRIVATE */
+static void
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_swap_alpha");
@@ -475,7 +399,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row) #endif
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
-void /* PRIVATE */
+static void
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_invert_alpha");
@@ -568,70 +492,81 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) }
}
#endif
-#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
-#ifdef PNG_MNG_FEATURES_SUPPORTED
-/* Undoes intrapixel differencing */
+/* Transform the data according to the user's wishes. The order of
+ * transformations is significant.
+ */
void /* PRIVATE */
-png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
+png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
{
- png_debug(1, "in png_do_write_intrapixel");
+ png_debug(1, "in png_do_write_transformations");
- if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
- {
- int bytes_per_pixel;
- png_uint_32 row_width = row_info->width;
- if (row_info->bit_depth == 8)
- {
- png_bytep rp;
- png_uint_32 i;
+ if (png_ptr == NULL)
+ return;
- if (row_info->color_type == PNG_COLOR_TYPE_RGB)
- bytes_per_pixel = 3;
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
+ if (png_ptr->transformations & PNG_USER_TRANSFORM)
+ if (png_ptr->write_user_transform_fn != NULL)
+ (*(png_ptr->write_user_transform_fn)) /* User write transform
+ function */
+ (png_ptr, /* png_ptr */
+ row_info, /* row_info: */
+ /* png_uint_32 width; width of row */
+ /* png_size_t rowbytes; number of bytes in row */
+ /* png_byte color_type; color type of pixels */
+ /* png_byte bit_depth; bit depth of samples */
+ /* png_byte channels; number of channels (1-4) */
+ /* png_byte pixel_depth; bits per pixel (depth*channels) */
+ png_ptr->row_buf + 1); /* start of pixel data for row */
+#endif
- else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
- bytes_per_pixel = 4;
+#ifdef PNG_WRITE_FILLER_SUPPORTED
+ if (png_ptr->transformations & PNG_FILLER)
+ png_do_strip_channel(row_info, png_ptr->row_buf + 1,
+ !(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
+#endif
- else
- return;
+#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
+ if (png_ptr->transformations & PNG_PACKSWAP)
+ png_do_packswap(row_info, png_ptr->row_buf + 1);
+#endif
- for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
- {
- *(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
- *(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
- }
- }
+#ifdef PNG_WRITE_PACK_SUPPORTED
+ if (png_ptr->transformations & PNG_PACK)
+ png_do_pack(row_info, png_ptr->row_buf + 1,
+ (png_uint_32)png_ptr->bit_depth);
+#endif
-#ifdef PNG_WRITE_16BIT_SUPPORTED
- else if (row_info->bit_depth == 16)
- {
- png_bytep rp;
- png_uint_32 i;
+#ifdef PNG_WRITE_SWAP_SUPPORTED
+ if (png_ptr->transformations & PNG_SWAP_BYTES)
+ png_do_swap(row_info, png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_WRITE_SHIFT_SUPPORTED
+ if (png_ptr->transformations & PNG_SHIFT)
+ png_do_shift(row_info, png_ptr->row_buf + 1,
+ &(png_ptr->shift));
+#endif
- if (row_info->color_type == PNG_COLOR_TYPE_RGB)
- bytes_per_pixel = 6;
+#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
+ if (png_ptr->transformations & PNG_SWAP_ALPHA)
+ png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
+#endif
- else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
- bytes_per_pixel = 8;
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
+ if (png_ptr->transformations & PNG_INVERT_ALPHA)
+ png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
+#endif
- else
- return;
+#ifdef PNG_WRITE_BGR_SUPPORTED
+ if (png_ptr->transformations & PNG_BGR)
+ png_do_bgr(row_info, png_ptr->row_buf + 1);
+#endif
- for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
- {
- png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
- png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
- png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
- png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
- png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
- *(rp ) = (png_byte)((red >> 8) & 0xff);
- *(rp + 1) = (png_byte)(red & 0xff);
- *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
- *(rp + 5) = (png_byte)(blue & 0xff);
- }
- }
-#endif /* PNG_WRITE_16BIT_SUPPORTED */
- }
+#ifdef PNG_WRITE_INVERT_SUPPORTED
+ if (png_ptr->transformations & PNG_INVERT_MONO)
+ png_do_invert(row_info, png_ptr->row_buf + 1);
+#endif
}
-#endif /* PNG_MNG_FEATURES_SUPPORTED */
+#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
#endif /* PNG_WRITE_SUPPORTED */
diff --git a/plugins/AdvaImg/src/LibPNG/pngwutil.c b/plugins/AdvaImg/src/LibPNG/pngwutil.c index 9f3444e75f..da4ec20dd8 100644 --- a/plugins/AdvaImg/src/LibPNG/pngwutil.c +++ b/plugins/AdvaImg/src/LibPNG/pngwutil.c @@ -898,11 +898,6 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, /* Write the chunk */
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
-#ifdef PNG_WRITE_APNG_SUPPORTED
- png_ptr->first_frame_width = width;
- png_ptr->first_frame_height = height;
-#endif
-
if (!(png_ptr->do_filter))
{
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
@@ -1081,15 +1076,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr));
# endif
-# ifdef PNG_WRITE_APNG_SUPPORTED
- if (png_ptr->num_frames_written == 0)
-# endif
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
-# ifdef PNG_WRITE_APNG_SUPPORTED
- else
- png_write_fdAT(png_ptr, data, size);
-# endif /* PNG_WRITE_APNG_SUPPORTED */
-
png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->zstream.next_out = data;
@@ -1135,15 +1122,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr));
# endif
-# ifdef PNG_WRITE_APNG_SUPPORTED
- if (png_ptr->num_frames_written == 0)
-# endif
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
-# ifdef PNG_WRITE_APNG_SUPPORTED
- else
- png_write_fdAT(png_ptr, data, size);
-# endif /* PNG_WRITE_APNG_SUPPORTED */
-
png_ptr->zstream.avail_out = 0;
png_ptr->zstream.next_out = NULL;
png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
@@ -1955,82 +1934,6 @@ png_write_tIME(png_structrp png_ptr, png_const_timep mod_time) }
#endif
-#ifdef PNG_WRITE_APNG_SUPPORTED
-void /* PRIVATE */
-png_write_acTL(png_structp png_ptr,
- png_uint_32 num_frames, png_uint_32 num_plays)
-{
- png_byte buf[8];
-
- png_debug(1, "in png_write_acTL");
-
- png_ptr->num_frames_to_write = num_frames;
-
- if (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN)
- num_frames--;
-
- png_save_uint_32(buf, num_frames);
- png_save_uint_32(buf + 4, num_plays);
-
- png_write_complete_chunk(png_ptr, png_acTL, buf, (png_size_t)8);
-}
-
-void /* PRIVATE */
-png_write_fcTL(png_structp png_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_byte buf[26];
-
- png_debug(1, "in png_write_fcTL");
-
- if (png_ptr->num_frames_written == 0 && (x_offset != 0 || y_offset != 0))
- png_error(png_ptr, "x and/or y offset for the first frame aren't 0");
- if (png_ptr->num_frames_written == 0 &&
- (width != png_ptr->first_frame_width ||
- height != png_ptr->first_frame_height))
- png_error(png_ptr, "width and/or height in the first frame's fcTL "
- "don't match the ones in IHDR");
-
- /* more error checking */
- png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
- delay_num, delay_den, dispose_op, blend_op);
-
- png_save_uint_32(buf, png_ptr->next_seq_num);
- png_save_uint_32(buf + 4, width);
- png_save_uint_32(buf + 8, height);
- png_save_uint_32(buf + 12, x_offset);
- png_save_uint_32(buf + 16, y_offset);
- png_save_uint_16(buf + 20, delay_num);
- png_save_uint_16(buf + 22, delay_den);
- buf[24] = dispose_op;
- buf[25] = blend_op;
-
- png_write_complete_chunk(png_ptr, png_fcTL, buf, (png_size_t)26);
-
- png_ptr->next_seq_num++;
-}
-
-void /* PRIVATE */
-png_write_fdAT(png_structp png_ptr,
- png_const_bytep data, png_size_t length)
-{
- png_byte buf[4];
-
- png_write_chunk_header(png_ptr, png_fdAT, (png_uint_32)(4 + length));
-
- png_save_uint_32(buf, png_ptr->next_seq_num);
- png_write_chunk_data(png_ptr, buf, 4);
-
- png_write_chunk_data(png_ptr, data, length);
-
- png_write_chunk_end(png_ptr);
-
- png_ptr->next_seq_num++;
-}
-#endif /* PNG_WRITE_APNG_SUPPORTED */
-
/* Initializes the row writing capability of libpng */
void /* PRIVATE */
png_write_start_row(png_structrp png_ptr)
@@ -2406,7 +2309,8 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) * been specified by the application, and then writes the row out with the
* chosen filter.
*/
-static void png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
+static void
+png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
png_size_t row_bytes);
#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1)
@@ -3117,39 +3021,4 @@ png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row, }
#endif
}
-
-#ifdef PNG_WRITE_APNG_SUPPORTED
-void /* PRIVATE */
-png_write_reset(png_structp png_ptr)
-{
- png_ptr->row_number = 0;
- png_ptr->pass = 0;
- png_ptr->mode &= ~PNG_HAVE_IDAT;
-}
-
-void /* PRIVATE */
-png_write_reinit(png_structp png_ptr, png_infop info_ptr,
- png_uint_32 width, png_uint_32 height)
-{
- if (png_ptr->num_frames_written == 0 &&
- (width != png_ptr->first_frame_width ||
- height != png_ptr->first_frame_height))
- png_error(png_ptr, "width and/or height in the first frame's fcTL "
- "don't match the ones in IHDR");
- if (width > png_ptr->first_frame_width ||
- height > png_ptr->first_frame_height)
- png_error(png_ptr, "width and/or height for a frame greater than"
- "the ones in IHDR");
-
- png_set_IHDR(png_ptr, info_ptr, width, height,
- info_ptr->bit_depth, info_ptr->color_type,
- info_ptr->interlace_type, info_ptr->compression_type,
- info_ptr->filter_type);
-
- png_ptr->width = width;
- png_ptr->height = height;
- png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
- png_ptr->usr_width = png_ptr->width;
-}
-#endif /* PNG_WRITE_APNG_SUPPORTED */
#endif /* PNG_WRITE_SUPPORTED */
|