[libpng17] 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.
This commit is contained in:
John Bowler 2013-06-06 14:57:14 -05:00 committed by Glenn Randers-Pehrson
parent 30662f5e92
commit b88c94208a
5 changed files with 37 additions and 9 deletions

View File

@ -309,6 +309,9 @@ Version 1.7.0beta14 [June 6, 2013]
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 STDIO/#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.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4597,6 +4597,9 @@ Version 1.7.0beta14 [June 6, 2013]
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 STDIO/#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.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -347,11 +347,12 @@ AC_ARG_ENABLE([arm-neon],
[Enable ARM NEON optimizations: =no/off, check, api, yes/on:]
[no/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; yes/on: turn on unconditionally.]),
[a call to png_set_option; yes/on: turn on unconditionally.]
[If not specified: determined by the compiler.]),
[case "$enableval" in
no|off)
# disable the default enabling on __ARM_NEON__ systems:
AC_DEFINE([PNG_NO_ARM_NEON], [],
AC_DEFINE([PNG_ARM_NEON_NOT_SUPPORTED], [],
[Disable ARM Neon optimizations])
# Prevent inclusion of the assembler files below:
enable_arm_neon=no;;

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.7.0beta14 - May 13, 2013
* libpng version 1.7.0beta14 - June 6, 2013
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -194,6 +194,30 @@
* PNG_USE_DLL is set.
*/
/* Compile time options.
* =====================
* In a multi-arch build the compiler may compile the code several times for the
* same object module, producing different codes for different architectures.
* When this happens configure-time setting of the target host options cannot be
* done and this interferes with the handling of the ARM NEON optimizations, and
* possibly other similiar optimizations. Put additional tests here; in general
* this is needed when the same option can be changed at both compile time and
* run time depending on the target OS (i.e. iOS vs Android.)
*/
#ifdef __ARM_NEON__
/* If the default below causes problems set PNG_ARM_NEON_NOT_SUPPORTED either
* by passing --enable-arm-neon=no to configure or setting it in some other
* way when pnglibconf.h is built.
*/
# if (!defined PNG_ARM_NEON_SUPPORTED) && (!defined PNG_ARM_NEON_NOT_SUPPORTED)
# define PNG_ARM_NEON_SUPPORTED
# endif
#endif
#if (defined PNG_ARM_NEON_SUPPORTED) && (defined PNG_ARM_NEON_NOT_SUPPORTED)
# error configuration: ARM_NEON cannot both be supported and disabled
#endif
/* System specific discovery.
* ==========================
* This code is used at build time to find PNG_IMPEXP, the API settings

View File

@ -165,12 +165,6 @@ 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!)
@ -236,6 +230,8 @@ option SET_OPTION disabled
# These options are specific to the ARM NEON hardware optimizations:
#
# ARM_NEON: the optimization itself
# ARM_NEON_NOT: disable the optimization even on systems that apparently support
# it (where the compiler defines __ARM_NEON__).
# 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
setting ZLIB_VERNUM default @ZLIB_VERNUM
@ -243,6 +239,7 @@ setting ZLIB_VERNUM default @ZLIB_VERNUM
# png_set_hardware API.
option ARM_NEON disabled,
sets FILTER_OPTIMIZATIONS png_init_filter_functions_neon
option ARM_NEON_NOT disabled
option ARM_NEON_API disabled enables SET_OPTION ARM_NEON
option ARM_NEON_CHECK disabled enables ARM_NEON