|
fukasawa |
e60969 |
/* contrib/arm-neon/android-ndk.c
|
|
fukasawa |
e60969 |
*
|
|
fukasawa |
e60969 |
* Copyright (c) 2014 Glenn Randers-Pehrson
|
|
fukasawa |
e60969 |
* Written by John Bowler, 2014.
|
|
fukasawa |
e60969 |
* Last changed in libpng 1.6.10 [March 6, 2014]
|
|
fukasawa |
e60969 |
*
|
|
fukasawa |
e60969 |
* This code is released under the libpng license.
|
|
fukasawa |
e60969 |
* For conditions of distribution and use, see the disclaimer
|
|
fukasawa |
e60969 |
* and license in png.h
|
|
fukasawa |
e60969 |
*
|
|
fukasawa |
e60969 |
* SEE contrib/arm-neon/README before reporting bugs
|
|
fukasawa |
e60969 |
*
|
|
fukasawa |
e60969 |
* STATUS: COMPILED, UNTESTED
|
|
fukasawa |
e60969 |
* BUG REPORTS: png-mng-implement@sourceforge.net
|
|
fukasawa |
e60969 |
*
|
|
fukasawa |
e60969 |
* png_have_neon implemented for the Android NDK, see:
|
|
fukasawa |
e60969 |
*
|
|
fukasawa |
e60969 |
* Documentation:
|
|
fukasawa |
e60969 |
* http://www.kandroid.org/ndk/docs/CPU-ARM-NEON.html
|
|
fukasawa |
e60969 |
* http://code.google.com/p/android/issues/detail?id=49065
|
|
fukasawa |
e60969 |
*
|
|
fukasawa |
e60969 |
* NOTE: this requires that libpng is built against the Android NDK and linked
|
|
fukasawa |
e60969 |
* with an implementation of the Android ARM 'cpu-features' library. The code
|
|
fukasawa |
e60969 |
* has been compiled only, not linked: no version of the library has been found,
|
|
fukasawa |
e60969 |
* only the header files exist in the NDK.
|
|
fukasawa |
e60969 |
*/
|
|
fukasawa |
e60969 |
#include <cpu-features.h></cpu-features.h>
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
static int
|
|
fukasawa |
e60969 |
png_have_neon(png_structp png_ptr)
|
|
fukasawa |
e60969 |
{
|
|
fukasawa |
e60969 |
/* This is a whole lot easier than the linux code, however it is probably
|
|
fukasawa |
e60969 |
* implemented as below, therefore it is better to cache the result (these
|
|
fukasawa |
e60969 |
* function calls may be slow!)
|
|
fukasawa |
e60969 |
*/
|
|
fukasawa |
e60969 |
PNG_UNUSED(png_ptr)
|
|
fukasawa |
e60969 |
return android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM &&
|
|
fukasawa |
e60969 |
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
|
|
fukasawa |
e60969 |
}
|