[libpng16] Corrected Android builds and corrected libpng.vers with symbol
prefixing This adds an API to set optimization options externally, providing an alternative and general solution for the non-portable run-time tests used by the ARM Neon code. It also makes those tests compile and link on Android. The order of settings vs options in pnglibconf.h is reversed to allow settings to depend on options and options can now set (or override) the defaults for settings.
This commit is contained in:
parent
e15b537825
commit
f3728100d9
13
ANNOUNCE
13
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.6.1beta06 - March 2, 2013
|
||||
Libpng 1.6.1beta06 - March 4, 2013
|
||||
|
||||
This is not intended to be a public release. It will be replaced
|
||||
within a few weeks by a public version or by another test version.
|
||||
@ -67,8 +67,17 @@ Version 1.6.1beta04 [February 27, 2013]
|
||||
Version 1.6.1beta05 [March 1, 2013]
|
||||
Avoid a possible memory leak in contrib/gregbook/readpng.c
|
||||
|
||||
Version 1.6.1beta06 [March 2, 2013]
|
||||
Version 1.6.1beta06 [March 4, 2013]
|
||||
Better documentation of unknown handling API interactions.
|
||||
Corrected Android builds and corrected libpng.vers with symbol
|
||||
prefixing This adds an API to set optimization options externally,
|
||||
providing an alternative and general solution for the non-portable
|
||||
run-time tests used by the ARM Neon code. It also makes those tests
|
||||
compile and link on Android.
|
||||
The order of settings vs options in pnglibconf.h is reversed to allow
|
||||
settings to depend on options and options can now set (or override) the
|
||||
defaults for settings.
|
||||
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
10
CHANGES
10
CHANGES
@ -4424,8 +4424,16 @@ Version 1.6.1beta04 [February 27, 2013]
|
||||
Version 1.6.1beta05 [March 1, 2013]
|
||||
Avoid a possible memory leak in contrib/gregbook/readpng.c
|
||||
|
||||
Version 1.6.1beta06 [March 2, 2013]
|
||||
Version 1.6.1beta06 [March 4, 2013]
|
||||
Better documentation of unknown handling API interactions.
|
||||
Corrected Android builds and corrected libpng.vers with symbol
|
||||
prefixing This adds an API to set optimization options externally,
|
||||
providing an alternative and general solution for the non-portable
|
||||
run-time tests used by the ARM Neon code. It also makes those tests
|
||||
compile and link on Android.
|
||||
The order of settings vs options in pnglibconf.h is reversed to allow
|
||||
settings to depend on options and options can now set (or override) the
|
||||
defaults for settings.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
@ -16,16 +16,7 @@
|
||||
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
|
||||
defined(__ARM_NEON__)
|
||||
/* __arm__ is defined by GCC, MSVC defines _M_ARM to the ARM version number,
|
||||
* Andoid intends to define __ANDROID__, however there are bugs in their
|
||||
* toolchain; use -D__ANDROID__ to work round this.
|
||||
*
|
||||
* __ARM_NEON__ is used to ensure that the compiler has the appropriate ARM
|
||||
* NEON support
|
||||
*/
|
||||
|
||||
#ifdef PNG_ARM_NEON_SUPPORTED
|
||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
|
||||
@ -45,7 +36,8 @@ png_have_neon(png_structp png_ptr)
|
||||
* implemented as below, therefore it is better to cache the result (these
|
||||
* function calls may be slow!)
|
||||
*/
|
||||
return andoid_getCpuFamily() == ANDROID_CPU_FAMILY_ARM &&
|
||||
PNG_UNUSED(png_ptr)
|
||||
return android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM &&
|
||||
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
|
||||
}
|
||||
#elif defined(__linux__)
|
||||
@ -161,7 +153,18 @@ png_have_neon(png_structp png_ptr)
|
||||
void
|
||||
png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
{
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
switch ((pp->options >> PNG_ARM_NEON) & 3)
|
||||
{
|
||||
case PNG_OPTION_UNSET:
|
||||
/* Allow the run-time check to execute if it has been enabled -
|
||||
* thus both API and CHECK can be turned on. If it isn't supported
|
||||
* this case will fall through to the 'default' below, which just
|
||||
* returns.
|
||||
*/
|
||||
#endif /* PNG_ARM_NEON_API_SUPPORTED */
|
||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED
|
||||
{
|
||||
static volatile sig_atomic_t no_neon = -1; /* not checked */
|
||||
|
||||
if (no_neon < 0)
|
||||
@ -169,7 +172,20 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
|
||||
if (no_neon)
|
||||
return;
|
||||
}
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
break;
|
||||
#endif
|
||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
case PNG_OPTION_ON:
|
||||
/* Option turned on */
|
||||
break;
|
||||
|
||||
default: /* OFF or INVALID */
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* IMPORTANT: any new external functions used here must be declared using
|
||||
* PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the
|
||||
|
33
configure.ac
33
configure.ac
@ -233,18 +233,27 @@ AC_SUBST([AM_CCASFLAGS], [-Wa,--noexecstack])
|
||||
|
||||
AC_ARG_ENABLE([arm-neon],
|
||||
AS_HELP_STRING([[[--enable-arm-neon]]],
|
||||
[Enable ARM NEON optimizations: use 'always' to turn off run-time checks]),
|
||||
[if test "${enableval}" = "yes" -o "${enableval}" = "always"; then
|
||||
AC_DEFINE([PNG_FILTER_OPTIMIZATIONS],
|
||||
[png_init_filter_functions_neon],
|
||||
[ARM NEON filter initialization function])
|
||||
AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [],
|
||||
[Align row buffers])
|
||||
if test "${enableval}" = "always"; then
|
||||
AC_DEFINE([PNG_NO_ARM_NEON_CHECK], [],
|
||||
[Turn off run-time checking for ARM NEON support])
|
||||
fi
|
||||
fi])
|
||||
[Enable ARM NEON optimizations: =off, check, api, on:]
|
||||
[off: disable the optimizations; check: use internal checking code]
|
||||
[(deprecated and poorly supported); api: disable by default, enable by]
|
||||
[a call to png_set_option; on: turn on unconditionally. The]
|
||||
[default is 'on' if __ARM_NEON__ is defined, otherwise 'off'.]),
|
||||
[case "$enableval" in
|
||||
off)
|
||||
AC_DEFINE([PNG_NO_ARM_NEON], [],
|
||||
[Disable ARM Neon optimizations]);;
|
||||
check)
|
||||
AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
|
||||
[Check for ARM Neon support at run-time]);;
|
||||
api)
|
||||
AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [],
|
||||
[Turn on ARM Neon optimizations at run-time]);;
|
||||
on)
|
||||
AC_DEFINE([PNG_ARM_NEON_SUPPORTED], [],
|
||||
[Enable ARM Neon optimizations]);;
|
||||
*)
|
||||
AC_MSG_ERROR([arm-neon: option value required (off/check/api/on)]);;
|
||||
esac])
|
||||
AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" != "no"])
|
||||
|
||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||
|
25
png.c
25
png.c
@ -768,13 +768,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.1beta06 - March 2, 2013" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.1beta06 - March 4, 2013" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2013 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.1beta06 - March 2, 2013\
|
||||
return "libpng version 1.6.1beta06 - March 4, 2013\
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
@ -4012,6 +4012,27 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
|
||||
}
|
||||
#endif /* READ_GAMMA */
|
||||
|
||||
/* HARDWARE OPTION SUPPORT */
|
||||
#ifdef PNG_SET_OPTION_SUPPORTED
|
||||
int PNGAPI
|
||||
png_set_option(png_structrp png_ptr, int option, int onoff)
|
||||
{
|
||||
if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT &&
|
||||
(option & 1) == 0)
|
||||
{
|
||||
int mask = 3 << option;
|
||||
int setting = (2 + (onoff != 0)) << option;
|
||||
int current = png_ptr->options;
|
||||
|
||||
png_ptr->options = (png_byte)((current & ~mask) | setting);
|
||||
|
||||
return (current & mask) >> option;
|
||||
}
|
||||
|
||||
return PNG_OPTION_INVALID;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* sRGB support */
|
||||
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
|
||||
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||
|
53
png.h
53
png.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.1beta06 - March 2, 2013
|
||||
* libpng version 1.6.1beta06 - March 4, 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.)
|
||||
@ -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.1beta06 - March 2, 2013: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.6.1beta06 - March 4, 2013: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@ -201,7 +201,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.1beta06, March 2, 2013, are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.1beta06, March 4, 2013, 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:
|
||||
@ -313,7 +313,7 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* March 2, 2013
|
||||
* March 4, 2013
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
@ -381,7 +381,7 @@
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.1beta06"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.1beta06 - March 2, 2013\n"
|
||||
" libpng version 1.6.1beta06 - March 4, 2013\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -3219,6 +3219,47 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||
# endif
|
||||
#endif /* CHECK_FOR_INVALID_INDEX */
|
||||
|
||||
/*******************************************************************************
|
||||
* IMPLEMENTATION OPTIONS
|
||||
*******************************************************************************
|
||||
*
|
||||
* Support for arbitrary implementation-specific optimizations. The API allows
|
||||
* particular options to be turned on or off. 'Option' is the number of the
|
||||
* option and 'onoff' is 0 (off) or non-0 (on). The value returned is given
|
||||
* by the PNG_OPTION_ defines below.
|
||||
*
|
||||
* HARDWARE: normally hardware capabilites, such as the Intel SSE instructions,
|
||||
* are detected at run time, however sometimes it may be impossible
|
||||
* to do this in user mode, in which case it is necessary to discover
|
||||
* the capabilities in an OS specific way. Such capabilities are
|
||||
* listed here when libpng has support for them and must be turned
|
||||
* ON by the application if present.
|
||||
*
|
||||
* SOFTWARE: sometimes software optimizations actually result in performance
|
||||
* decrease on some architectures or systems, or with some sets of
|
||||
* PNG images. 'Software' options allow such optimizations to be
|
||||
* selected at run time.
|
||||
*/
|
||||
#ifdef PNG_SET_OPTION_SUPPORTED
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
|
||||
#endif
|
||||
#define PNG_OPTION_NEXT 2 /* Next option - numbers must be even */
|
||||
|
||||
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
||||
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
||||
#define PNG_OPTION_INVALID 1 /* Option number out of range */
|
||||
#define PNG_OPTION_OFF 2
|
||||
#define PNG_OPTION_ON 3
|
||||
|
||||
PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
|
||||
int onoff));
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* END OF HARDWARE OPTIONS
|
||||
******************************************************************************/
|
||||
|
||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
|
||||
* defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt
|
||||
*/
|
||||
@ -3228,7 +3269,7 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||
* scripts/symbols.def as well.
|
||||
*/
|
||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||
PNG_EXPORT_LAST_ORDINAL(243);
|
||||
PNG_EXPORT_LAST_ORDINAL(244);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -357,6 +357,11 @@ struct png_struct_def
|
||||
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
|
||||
#endif
|
||||
|
||||
/* Options */
|
||||
#ifdef PNG_SET_OPTION_SUPPORTED
|
||||
png_byte options; /* On/off state (up to 4 options) */
|
||||
#endif
|
||||
|
||||
#if PNG_LIBPNG_VER < 10700
|
||||
/* To do: remove this from libpng-1.7 */
|
||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||
|
@ -113,6 +113,16 @@ END{
|
||||
err = 1
|
||||
}
|
||||
unexported=0
|
||||
# Add a standard header to symbols.new:
|
||||
print ";Version INSERT-VERSION-HERE" >of
|
||||
print ";--------------------------------------------------------------" >of
|
||||
print "; LIBPNG symbol list as a Win32 DEF file" >of
|
||||
print "; Contains all the symbols that can be exported from libpng" >of
|
||||
print ";--------------------------------------------------------------" >of
|
||||
print "LIBRARY" >of
|
||||
print "" >of
|
||||
print "EXPORTS" >of
|
||||
|
||||
for (o=1; o<=lasto; ++o) {
|
||||
if (symbol[o] == "" && removed[o] == "") {
|
||||
if (unexported == 0) unexported = o
|
||||
|
@ -65,13 +65,21 @@ $1 ~ /^PNG_DFN_END_SORT/{
|
||||
# definition then replace any doubled "" that remain with a single
|
||||
# double quote. Notice that the original doubled double quotes
|
||||
# may have been split by tokenization
|
||||
#
|
||||
# Sometimes GCC splits the PNG_DFN lines, we know this has happened
|
||||
# if the quotes aren't closed and must read another line. In this
|
||||
# case it is essential to reject lines that start '#' because those
|
||||
# are introduced #line directives.
|
||||
orig=$0
|
||||
line=$0
|
||||
lineno=FNR
|
||||
if (lineno == "") lineno=NR
|
||||
|
||||
if (gsub(/^[^"]*PNG_DFN *"/,"") != 1 || gsub(/"[^"]*$/, "") != 1) {
|
||||
print "line", NR, "processing failed:"
|
||||
if (sub(/^[^"]*PNG_DFN *"/,"",line) != 1) {
|
||||
print "line", lineno ": processing failed:"
|
||||
print orig
|
||||
print $0
|
||||
err=1
|
||||
next
|
||||
} else {
|
||||
++out_count
|
||||
}
|
||||
@ -79,7 +87,7 @@ $1 ~ /^PNG_DFN_END_SORT/{
|
||||
# Now examine quotes within the value:
|
||||
#
|
||||
# @" - delete this and any following spaces
|
||||
# "@ - delete this and any original spaces
|
||||
# "@ - delete this and any preceding spaces
|
||||
# @' - replace this by a double quote
|
||||
#
|
||||
# This allows macro substitution by the C compiler thus:
|
||||
@ -97,26 +105,86 @@ $1 ~ /^PNG_DFN_END_SORT/{
|
||||
#
|
||||
# #define name "John Smith"
|
||||
#
|
||||
while (sub(/@" */, "")) {
|
||||
if (!sub(/ *"@/, "")) {
|
||||
print "unbalanced @\" ... \"@ pair"
|
||||
err=1
|
||||
break
|
||||
while (1) {
|
||||
# While there is an @" remove it and the next "@
|
||||
if (line ~ /@"/) {
|
||||
if (line ~ /@".*"@/) {
|
||||
# Do this special case first to avoid swallowing extra spaces
|
||||
# before or after the @ stuff:
|
||||
if (!sub(/@" *"@/, "", line)) {
|
||||
# Ok, do it in pieces - there has to be a non-space between the
|
||||
# two. NOTE: really weird things happen if a leading @" is
|
||||
# lost - the code will error out below (I believe).
|
||||
if (!sub(/@" */, "", line) || !sub(/ *"@/, "", line)) {
|
||||
print "line", lineno, ": internal error:", orig
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Put any needed double quotes in
|
||||
gsub(/@'/,"\"")
|
||||
# There is no matching "@. Assume a split line
|
||||
else while (1) {
|
||||
if (getline nextline) {
|
||||
# If the line starts with '#' it is a preprocesor line directive
|
||||
# from cc -E, skip it:
|
||||
if (nextline !~ /^#/) {
|
||||
line = line " " nextline
|
||||
break
|
||||
}
|
||||
} else {
|
||||
# This is end-of-input - probably a missig "@ on the first line:
|
||||
print "line", lineno ": unbalanced @\" ... \"@ pair"
|
||||
err=1
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
# Keep going until all the @" have gone
|
||||
continue
|
||||
}
|
||||
|
||||
# Attempt to remove a trailing " (not preceded by '@') - if this can
|
||||
# be done stop now, if not assume a split line again
|
||||
if (sub(/"[^"]*$/, "", line))
|
||||
break
|
||||
|
||||
# Read another line
|
||||
while (1) {
|
||||
if (getline nextline) {
|
||||
if (nextline !~ /^#/) {
|
||||
line = line " " nextline
|
||||
# Go back to stripping @" "@ pairs
|
||||
break
|
||||
}
|
||||
} else {
|
||||
print "line", lineno ": unterminated PNG_DFN string"
|
||||
err=1
|
||||
next
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Put any needed double quotes in (at the end, because these would otherwise
|
||||
# interfere with the processing above.)
|
||||
gsub(/@'/,"\"", line)
|
||||
|
||||
# Remove any trailing spaces (not really required, but for
|
||||
# editorial consistency
|
||||
sub(/ *$/, "")
|
||||
sub(/ *$/, "", line)
|
||||
|
||||
if (sort)
|
||||
array[$(sort)] = $0
|
||||
# Remove trailing CR
|
||||
sub(/
$/, "", line)
|
||||
|
||||
if (sort) {
|
||||
if (split(line, parts) < sort) {
|
||||
print "line", lineno ": missing sort field:", line
|
||||
err=1
|
||||
} else
|
||||
array[parts[sort]] = line
|
||||
}
|
||||
|
||||
else
|
||||
print $0 >out
|
||||
print line >out
|
||||
next
|
||||
}
|
||||
|
||||
|
@ -64,11 +64,15 @@ BEGIN{
|
||||
logunsupported=0 # write unsupported options too
|
||||
|
||||
# Precreate arrays
|
||||
# for each option:
|
||||
option[""] = "" # list of all options: default enabled/disabled
|
||||
done[""] = 1 # marks option as having been output
|
||||
requires[""] = "" # requires by option
|
||||
iffs[""] = "" # if by option
|
||||
enabledby[""] = "" # options that enable it by option
|
||||
sets[""] = "" # settings set by each option
|
||||
setval[""] = "" # value to set (indexed: 'option sets[option]')
|
||||
# for each setting:
|
||||
setting[""] = "" # requires by setting
|
||||
defaults[""] = "" # used for a defaulted value
|
||||
doneset[""] = 1 # marks setting as having been output
|
||||
@ -200,7 +204,7 @@ $1 == "com"{
|
||||
if (NF > 1) {
|
||||
# sub(/^[ ]*com[ ]*/, "")
|
||||
$1 = ""
|
||||
print comment, $0, cend >out
|
||||
print comment $0, cend >out
|
||||
} else
|
||||
print start end >out
|
||||
next
|
||||
@ -237,7 +241,9 @@ $1 == "file" && NF >= 2{
|
||||
next
|
||||
}
|
||||
|
||||
# option NAME ( (requires|enables|if) NAME* | on | off | disabled )*
|
||||
# option NAME ( (requires|enables|if) NAME* | on | off | disabled |
|
||||
# sets SETTING VALUE+ )*
|
||||
#
|
||||
# Declares an option 'NAME' and describes its default setting (disabled)
|
||||
# and its relationship to other options. The option is disabled
|
||||
# unless *all* the options listed after 'requires' are set and at
|
||||
@ -298,7 +304,7 @@ $1 == "option" && NF >= 2{
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if (val == "requires" || val == "if" || val == "enables") {
|
||||
} else if (val == "requires" || val == "if" || val == "enables" || val =="sets") {
|
||||
key = val
|
||||
} else if (key == "requires") {
|
||||
requires[opt] = requires[opt] " " val
|
||||
@ -306,6 +312,12 @@ $1 == "option" && NF >= 2{
|
||||
iffs[opt] = iffs[opt] " " val
|
||||
} else if (key == "enables") {
|
||||
enabledby[val] = enabledby[val] " " opt
|
||||
} else if (key == "sets") {
|
||||
sets[opt] = sets[opt] " " val
|
||||
key = "setval"
|
||||
set = val
|
||||
} else if (key == "setval") {
|
||||
setval[opt " " set] = setval[opt " " set] " " val
|
||||
} else
|
||||
break # bad line format
|
||||
}
|
||||
@ -522,83 +534,7 @@ END{
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Do the 'setting' values first, the algorithm the standard
|
||||
# tree walk (O(1)) done in an O(2) while/for loop; interations
|
||||
# settings x depth, outputing the deepest required macros
|
||||
# first.
|
||||
print "" >out
|
||||
print "/* SETTINGS */" >out
|
||||
print comment, "settings", cend >out
|
||||
# Sort (in dfn.awk) on field 2, the setting name
|
||||
print "PNG_DFN_START_SORT 2" >out
|
||||
finished = 0
|
||||
while (!finished) {
|
||||
finished = 1
|
||||
movement = 0 # done nothing
|
||||
for (i in setting) if (!doneset[i]) {
|
||||
nreqs = split(setting[i], r)
|
||||
if (nreqs > 0) {
|
||||
for (j=1; j<=nreqs; ++j) if (!doneset[r[j]]) {
|
||||
break
|
||||
}
|
||||
if (j<=nreqs) {
|
||||
finished = 0
|
||||
continue # try a different setting
|
||||
}
|
||||
}
|
||||
|
||||
# All the requirements have been processed, output
|
||||
# this setting.
|
||||
if (deb) print "setting", i
|
||||
deflt = defaults[i]
|
||||
# A leading @ means leave it unquoted so the preprocessor
|
||||
# can substitute the build time value
|
||||
if (deflt ~ /^ @/)
|
||||
deflt = " " subs substr(deflt, 3) sube
|
||||
# Remove any spurious trailing spaces
|
||||
sub(/ *$/,"",deflt)
|
||||
print "" >out
|
||||
print "/* setting: ", i >out
|
||||
print " * requires:" setting[i] >out
|
||||
print " * default: ", defaults[i] defltinfo, "*/" >out
|
||||
if (defaults[i] == "") { # no default, only check if defined
|
||||
print "#ifdef PNG_" i >out
|
||||
}
|
||||
for (j=1; j<=nreqs; ++j) {
|
||||
print "# ifndef PNG_" r[j] >out
|
||||
print error, i, "requires", r[j] end >out
|
||||
print "# endif" >out
|
||||
}
|
||||
if (defaults[i] != "") { # default handling
|
||||
print "#ifdef PNG_" i >out
|
||||
}
|
||||
# PNG_<i> is defined, so substitute the value:
|
||||
print def i, subs "PNG_" i sube end >out
|
||||
if (defaults[i] != "") {
|
||||
print "#else /*default*/" >out
|
||||
# And add the default definition for the benefit
|
||||
# of later settings an options test:
|
||||
print "# define PNG_" i deflt >out
|
||||
print def i deflt end >out
|
||||
}
|
||||
print "#endif" >out
|
||||
|
||||
doneset[i] = 1
|
||||
++movement
|
||||
}
|
||||
|
||||
if (!finished && !movement) {
|
||||
print "setting: loop or missing setting in 'requires', cannot process:"
|
||||
for (i in setting) if (!doneset[i]) {
|
||||
print " setting", i, "requires" setting[i]
|
||||
}
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
print "PNG_DFN_END_SORT" >out
|
||||
print comment, "end of settings", cend >out
|
||||
|
||||
# Now do the options - somewhat more complex. The dependency
|
||||
# Do the options first (allowing options to set settings). The dependency
|
||||
# tree is thus:
|
||||
#
|
||||
# name > name
|
||||
@ -690,7 +626,7 @@ END{
|
||||
}
|
||||
if (err) exit 1
|
||||
|
||||
# Sort options too
|
||||
# Sort options:
|
||||
print "PNG_DFN_START_SORT 2" >out
|
||||
|
||||
# option[i] is now the complete list of all the tokens we may
|
||||
@ -731,7 +667,8 @@ END{
|
||||
print "/* option:", i, option[i] >out
|
||||
print " * requires: " requires[i] >out
|
||||
print " * if: " iffs[i] >out
|
||||
print " * enabled-by:" enabledby[i], "*/" >out
|
||||
print " * enabled-by:" enabledby[i] >out
|
||||
print " * sets: " sets[i], "*/" >out
|
||||
print "#undef PNG_on" >out
|
||||
print "#define PNG_on 1" >out
|
||||
|
||||
@ -814,6 +751,21 @@ END{
|
||||
print error, i, "is on: enabled by:" iffs[i] enabledby[i] ", requires" requires[i] end >out
|
||||
} else if (i !~ /^ok_/) {
|
||||
print def i sup >out
|
||||
# Supported option, set required settings
|
||||
nreqs = split(sets[i], r)
|
||||
for (j=1; j<=nreqs; ++j) {
|
||||
print "# ifdef PNG_set_" r[j] >out
|
||||
# Some other option has already set a value:
|
||||
print error, i, "sets", r[j] ": duplicate setting" end >out
|
||||
print error, " previous value: " end "PNG_set_" r[j] >out
|
||||
print "# else" >out
|
||||
# Else set the default: note that this won't accept arbitrary
|
||||
# values, the setval string must be acceptable to all the C
|
||||
# compilers we use. That means it must be VERY simple; a number,
|
||||
# a name or a string.
|
||||
print "# define PNG_set_" r[j], setval[i " " r[j]] >out
|
||||
print "# endif" >out
|
||||
}
|
||||
}
|
||||
print "# endif /* definition */" >out
|
||||
print "#endif /*requires, if*/" >out
|
||||
@ -847,6 +799,93 @@ END{
|
||||
print "PNG_DFN_END_SORT" >out
|
||||
print comment, "end of options", cend >out
|
||||
|
||||
# Do the 'setting' values second, the algorithm the standard
|
||||
# tree walk (O(1)) done in an O(2) while/for loop; interations
|
||||
# settings x depth, outputing the deepest required macros
|
||||
# first.
|
||||
print "" >out
|
||||
print "/* SETTINGS */" >out
|
||||
print comment, "settings", cend >out
|
||||
# Sort (in dfn.awk) on field 2, the setting name
|
||||
print "PNG_DFN_START_SORT 2" >out
|
||||
finished = 0
|
||||
while (!finished) {
|
||||
finished = 1
|
||||
movement = 0 # done nothing
|
||||
for (i in setting) if (!doneset[i]) {
|
||||
nreqs = split(setting[i], r)
|
||||
if (nreqs > 0) {
|
||||
# By default assume the requires values are options, but if there
|
||||
# is no option with that name check for a setting
|
||||
for (j=1; j<=nreqs; ++j) if (option[r[j]] == "" && !doneset[r[j]]) {
|
||||
break
|
||||
}
|
||||
if (j<=nreqs) {
|
||||
finished = 0
|
||||
continue # try a different setting
|
||||
}
|
||||
}
|
||||
|
||||
# All the requirements have been processed, output
|
||||
# this setting.
|
||||
if (deb) print "setting", i
|
||||
deflt = defaults[i]
|
||||
# Remove any spurious trailing spaces
|
||||
sub(/ *$/,"",deflt)
|
||||
# A leading @ means leave it unquoted so the preprocessor
|
||||
# can substitute the build time value
|
||||
if (deflt ~ /^ @/)
|
||||
deflt = " " subs substr(deflt, 3) sube
|
||||
print "" >out
|
||||
print "/* setting: ", i >out
|
||||
print " * requires:" setting[i] >out
|
||||
print " * default: ", defaults[i] deflt, "*/" >out
|
||||
for (j=1; j<=nreqs; ++j) {
|
||||
if (option[r[j]] != "")
|
||||
print "#ifndef PNG_" r[j] "_SUPPORTED" >out
|
||||
else
|
||||
print "#ifndef PNG_" r[j] >out
|
||||
print error, i, "requires", r[j] end >out
|
||||
print "# endif" >out
|
||||
}
|
||||
# The precedence is:
|
||||
#
|
||||
# 1) External definition; trumps:
|
||||
# 2) Option 'sets' value; trumps:
|
||||
# 3) Setting 'default'
|
||||
#
|
||||
print "#ifdef PNG_" i >out
|
||||
# PNG_<i> is defined, so substitute the value:
|
||||
print def i, subs "PNG_" i sube end >out
|
||||
print "#else /* use default */" >out
|
||||
print "# ifdef PNG_set_" i >out
|
||||
# Value from an option 'sets' argument
|
||||
print def i, subs "PNG_set_" i sube end >out
|
||||
# This is so that subsequent tests on the setting work:
|
||||
print "# define PNG_" i, "1" >out
|
||||
if (defaults[i] != "") {
|
||||
print "# else /*default*/" >out
|
||||
print def i deflt end >out
|
||||
print "# define PNG_" i, "1" >out
|
||||
}
|
||||
print "# endif /* defaults */" >out
|
||||
print "#endif /* setting", i, "*/" >out
|
||||
|
||||
doneset[i] = 1
|
||||
++movement
|
||||
}
|
||||
|
||||
if (!finished && !movement) {
|
||||
print "setting: loop or missing setting in 'requires', cannot process:"
|
||||
for (i in setting) if (!doneset[i]) {
|
||||
print " setting", i, "requires" setting[i]
|
||||
}
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
print "PNG_DFN_END_SORT" >out
|
||||
print comment, "end of settings", cend >out
|
||||
|
||||
# Regular end - everything looks ok
|
||||
if (protect != "") {
|
||||
print start "#endif", "/*", protect, "*/" end >out
|
||||
|
@ -27,7 +27,7 @@ file pnglibconf.h scripts/pnglibconf.dfa PNGLCONF_H
|
||||
# The syntax is detailed in scripts/options.awk; this is a summary
|
||||
# only:
|
||||
#
|
||||
# setting <name> [default]
|
||||
# setting <name> [requires ...] [default]
|
||||
# #define PNG_<name> <value> /* value comes from current setting */
|
||||
# option <name> [requires ...] [if ...] [enables ...] [disabled]
|
||||
# #define PNG_<name>_SUPPORTED if the requirements are met and
|
||||
@ -158,6 +158,12 @@ logunsupported = 1
|
||||
@# endif
|
||||
@#endif
|
||||
|
||||
# This changes the default for the ARM NEON optimizations according to
|
||||
# __ARM_NEON__
|
||||
@#ifdef __ARM_NEON__
|
||||
@# define PNG_ARM_NEON_SUPPORTED
|
||||
@#endif
|
||||
|
||||
# IN DEVELOPMENT
|
||||
# These are currently experimental features; define them if you want (NOTE:
|
||||
# experimental options must be disabled before they are defined in this file!)
|
||||
@ -199,11 +205,22 @@ setting DEFAULT_READ_MACROS default 1
|
||||
|
||||
setting FILTER_OPTIMIZATIONS
|
||||
|
||||
# This option turns on runtime checks for ARM NEON support, it is irrelevant
|
||||
# on other platforms and it is irrelevant unless NEON code is turned on. Checks
|
||||
# are on by default
|
||||
# Implementation specific control of the optimizations, enabled by those
|
||||
# hardware or software options that need it (typically when run-time choices
|
||||
# must be made by the user)
|
||||
option SET_OPTION disabled
|
||||
|
||||
option ARM_NEON_CHECK
|
||||
# These options are specific to the ARM NEON hardware optimizations:
|
||||
#
|
||||
# ARM_NEON: the optimization itself
|
||||
# ARM_NEON_API: allow the optimization to be switched on with png_set_hardware
|
||||
# ARM_NEON_CHECK: compile a run-time check to see if Neon extensions are
|
||||
# supported, this is poorly supported and deprectated - use the
|
||||
# png_set_hardware API.
|
||||
option ARM_NEON disabled,
|
||||
sets FILTER_OPTIMIZATIONS png_init_filter_functions_neon
|
||||
option ARM_NEON_API disabled enables SET_OPTION ARM_NEON
|
||||
option ARM_NEON_CHECK disabled enables ARM_NEON
|
||||
|
||||
# These settings configure the default compression level (0-9) and 'strategy';
|
||||
# strategy is as defined by the implementors of zlib, it describes the input
|
||||
|
@ -1,9 +1,8 @@
|
||||
|
||||
/* libpng STANDARD API DEFINITION */
|
||||
/* libpng 1.6.1beta06 STANDARD API DEFINITION */
|
||||
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* Libpng 1.6.1beta06 - March 2, 2013 */
|
||||
/* Libpng version 1.6.1beta06 - March 4, 2013 */
|
||||
|
||||
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */
|
||||
|
||||
@ -12,40 +11,16 @@
|
||||
/* and license in png.h */
|
||||
|
||||
/* pnglibconf.h */
|
||||
/* Machine generated file: DO NOT EDIT */
|
||||
/* Derived from: scripts/pnglibconf.dfa */
|
||||
/* If you edit this file by hand you must obey the rules expressed in */
|
||||
/* pnglibconf.dfa with respect to the dependencies between the following */
|
||||
/* symbols. It is much better to generate a new file using */
|
||||
/* scripts/libpngconf.mak */
|
||||
|
||||
#ifndef PNGLCONF_H
|
||||
#define PNGLCONF_H
|
||||
/* 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 */
|
||||
/* options */
|
||||
#define PNG_16BIT_SUPPORTED
|
||||
#define PNG_ALIGNED_MEMORY_SUPPORTED
|
||||
#define PNG_ARM_NEON_CHECK_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*/
|
||||
@ -130,6 +105,7 @@
|
||||
#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
|
||||
@ -210,4 +186,26 @@
|
||||
#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 */
|
||||
|
@ -1,3 +1,4 @@
|
||||
;Version 1.6.1beta06
|
||||
;--------------------------------------------------------------
|
||||
; LIBPNG symbol list as a Win32 DEF file
|
||||
; Contains all the symbols that can be exported from libpng
|
||||
@ -5,7 +6,6 @@
|
||||
LIBRARY
|
||||
|
||||
EXPORTS
|
||||
;Version 1.6.1beta06
|
||||
png_access_version_number @1
|
||||
png_set_sig_bytes @2
|
||||
png_sig_cmp @3
|
||||
@ -248,3 +248,4 @@ EXPORTS
|
||||
png_convert_to_rfc1123_buffer @241
|
||||
png_set_check_for_invalid_index @242
|
||||
png_get_palette_max @243
|
||||
png_set_option @244
|
||||
|
@ -35,13 +35,14 @@
|
||||
* defaulted to 'off' in scripts/pnglibconf.dfa
|
||||
*
|
||||
* Maintenance: if scripts/pnglibconf.dfa options are changed
|
||||
* from, or to, 'off' this needs updating!
|
||||
* from, or to, 'disabled' this needs updating!
|
||||
*/
|
||||
#define PNG_BENIGN_ERRORS_SUPPORTED
|
||||
#define PNG_ERROR_NUMBERS_SUPPORTED
|
||||
#define PNG_READ_BIG_ENDIAN_SUPPORTED /* should do nothing! */
|
||||
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
||||
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
||||
#define PNG_SET_OPTION_SUPPORTED
|
||||
|
||||
#undef PNG_H
|
||||
#include "../png.h"
|
||||
|
Loading…
Reference in New Issue
Block a user