Enable libpng NEON optimization in Android build for armeabi-v7a with NEON target

This commit is contained in:
Andrey Kamaev 2012-08-28 04:54:15 +04:00
parent c6d1421f9b
commit 90a3d227c9
2 changed files with 13 additions and 3 deletions

View File

@ -2,13 +2,23 @@
# CMake file for libpng. See root CMakeLists.txt # CMake file for libpng. See root CMakeLists.txt
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(NEON)
project(${PNG_LIBRARY} ASM)
else()
project(${PNG_LIBRARY}) project(${PNG_LIBRARY})
endif()
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIR}) ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" ${ZLIB_INCLUDE_DIR})
file(GLOB lib_srcs *.c) file(GLOB lib_srcs *.c)
file(GLOB lib_hdrs *.h) file(GLOB lib_hdrs *.h)
if(NEON)
list(APPEND lib_srcs arm/filter_neon.S)
add_definitions(-DPNG_ARM_NEON)
endif()
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------
# Define the library target: # Define the library target:
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------

View File

@ -3662,7 +3662,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
#ifdef PNG_ARM_NEON #ifdef PNG_ARM_NEON
#ifdef __linux__ #if defined __linux__ && !defined __ANDROID__
#include <stdio.h> #include <stdio.h>
#include <elf.h> #include <elf.h>
#include <asm/hwcap.h> #include <asm/hwcap.h>
@ -3695,7 +3695,7 @@ static int png_have_hwcap(unsigned cap)
static void static void
png_init_filter_functions_neon(png_structp pp, unsigned int bpp) png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
{ {
#ifdef __linux__ #if defined __linux__ && !defined __ANDROID__
if (!png_have_hwcap(HWCAP_NEON)) if (!png_have_hwcap(HWCAP_NEON))
return; return;
#endif #endif