mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Fixed ALIGNED_MEMORY support and
Allow run-time ARM NEON checking to be disabled. A new configure option: --enable-arm-neon=always will stop the run-time checks. New checks within arm/arm_init.c will cause the code not to be compiled unless __ARM_NEON__ is set. This should make it fail safe (if someone asks for it on then the build will fail if it can't be done.)
This commit is contained in:
parent
7363babe4f
commit
2799f74489
6
ANNOUNCE
6
ANNOUNCE
@ -179,6 +179,12 @@ Version 1.7.0beta02 [February 18, 2013]
|
||||
|
||||
Version 1.7.0beta03 [February 19, 2013]
|
||||
Reenabled code to allow zero length PLTE chunks for MNG.
|
||||
Fixed ALIGNED_MEMORY support.
|
||||
Allow run-time ARM NEON checking to be disabled. A new configure option:
|
||||
--enable-arm-neon=always will stop the run-time checks. New checks
|
||||
within arm/arm_init.c will cause the code not to be compiled unless
|
||||
__ARM_NEON__ is set. This should make it fail safe (if someone asks
|
||||
for it on then the build will fail if it can't be done.)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
6
CHANGES
6
CHANGES
@ -4466,6 +4466,12 @@ Version 1.7.0beta02 [February 18, 2013]
|
||||
|
||||
Version 1.7.0beta03 [February 19, 2013]
|
||||
Reenabled code to allow zero length PLTE chunks for MNG.
|
||||
Fixed ALIGNED_MEMORY support.
|
||||
Allow run-time ARM NEON checking to be disabled. A new configure option:
|
||||
--enable-arm-neon=always will stop the run-time checks. New checks
|
||||
within arm/arm_init.c will cause the code not to be compiled unless
|
||||
__ARM_NEON__ is set. This should make it fail safe (if someone asks
|
||||
for it on then the build will fail if it can't be done.)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
@ -16,12 +16,17 @@
|
||||
|
||||
#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
|
||||
*/
|
||||
#if defined(__linux__) && defined(__arm__)
|
||||
#define CHECK_NEON
|
||||
|
||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
|
||||
#ifdef __ANDROID__
|
||||
@ -43,7 +48,7 @@ png_have_neon(png_structp png_ptr)
|
||||
return andoid_getCpuFamily() == ANDROID_CPU_FAMILY_ARM &&
|
||||
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
|
||||
}
|
||||
#else
|
||||
#elif defined(__linux__)
|
||||
/* The generic __linux__ implementation requires reading /proc/self/auxv and
|
||||
* looking at each element for one that records NEON capabilities.
|
||||
*/
|
||||
@ -143,14 +148,20 @@ png_have_neon(png_structp png_ptr)
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
#endif /* !__ANDROID__ */
|
||||
#endif /* __linux__ && __arm__ */
|
||||
#else
|
||||
/* We don't know how to do a run-time check on this system */
|
||||
# error "no support for run-time ARM NEON checks"
|
||||
#endif /* OS checks */
|
||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||
|
||||
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
|
||||
# error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
|
||||
#endif
|
||||
|
||||
void
|
||||
png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
{
|
||||
#ifdef __arm__
|
||||
#ifdef CHECK_NEON
|
||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED
|
||||
static volatile sig_atomic_t no_neon = -1; /* not checked */
|
||||
|
||||
if (no_neon < 0)
|
||||
@ -158,7 +169,7 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
|
||||
if (no_neon)
|
||||
return;
|
||||
#endif
|
||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||
|
||||
/* IMPORTANT: any new external functions used here must be declared using
|
||||
* PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the
|
||||
@ -188,8 +199,5 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
|
||||
png_read_filter_row_paeth4_neon;
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(pp)
|
||||
PNG_UNUSED(bpp)
|
||||
#endif
|
||||
}
|
||||
#endif /* FILTER_OPTIMIZATIONS && __arm__ && __ARM_NEON__ */
|
||||
|
@ -10,11 +10,14 @@
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
/* This is required to get the symbol renames, which are #defines */
|
||||
/* This is required to get the symbol renames, which are #defines, and also
|
||||
* includes the value of PNG_FILTER_OPTIMIZATIONS.
|
||||
*/
|
||||
#define PNG_VERSION_INFO_ONLY
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#ifdef __arm__
|
||||
#if defined(PNG_FILTER_OPTIMIZATIONS) && defined(__arm__) && \
|
||||
defined(__ARM_NEON__)
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||
#endif
|
||||
@ -229,4 +232,4 @@ func png_read_filter_row_paeth3_neon, export=1
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
#endif
|
||||
#endif /* FILTER_OPTIMIZATIONS && __arm__ && __ARM_NEON__ */
|
||||
|
13
configure.ac
13
configure.ac
@ -340,15 +340,20 @@ AM_CONDITIONAL([DO_PNG_PREFIX], [test "${with_libpng_prefix:-no}" != "no"])
|
||||
AC_SUBST([AM_CCASFLAGS], [-Wa,--noexecstack])
|
||||
|
||||
AC_ARG_ENABLE([arm-neon],
|
||||
AS_HELP_STRING([[[--enable-arm-neon]]], [Enable ARM NEON optimizations]),
|
||||
[if test "${enableval}" = "yes"; then
|
||||
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], [1],
|
||||
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])
|
||||
AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes])
|
||||
AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" != "no"])
|
||||
|
||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* libpng version 1.7.0beta03 - February 18, 2013 */
|
||||
/* libpng version 1.7.0beta03 - February 19, 2013 */
|
||||
|
||||
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user