diff --git a/Android.mk b/Android.mk deleted file mode 100644 index ad4badc8..00000000 --- a/Android.mk +++ /dev/null @@ -1,276 +0,0 @@ -# Android makefile for libjpeg-turbo - -ifneq ($(TARGET_SIMULATOR), true) - -LOCAL_PATH := $(my-dir) -VERSION = 1.3.80 -BUILD := $(shell date +%Y%m%d) - -DEFINES = -DPACKAGE_NAME=\"libjpeg-turbo\" -DVERSION=\"$(VERSION)\" \ - -DBUILD=\"$(BUILD)\" - -# Default configuration (all of these can be overridden on the command line) -CFLAGS = -O3 -ifeq ($(strip $(TARGET_ARCH)), arm) -ifeq ($(TARGET_ARCH_VARIANT), armv7-a-neon) -WITH_SIMD = 1 -SIMD_ARCH = arm -endif -ifneq ($(findstring armv7-a, $(TARGET_ARCH_VARIANT)),) -CFLAGS += -fstrict-aliasing -endif -endif -WITH_TURBOJPEG = 1 -WITH_ARITH_ENC = 1 -WITH_ARITH_DEC = 1 -JPEG_LIB_VERSION = 62 -WITH_JPEG7 = 0 -WITH_JPEG8 = 0 -WITH_MEM_SRCDST = 1 - -# Define C macros based on configuration -ifeq ($(WITH_SIMD), 1) -DEFINES += -DWITH_SIMD -endif - -ifeq ($(WITH_ARITH_ENC), 1) -WITH_ARITH = 1 -DEFINES += -DC_ARITH_CODING_SUPPORTED -endif -ifeq ($(WITH_ARITH_DEC), 1) -WITH_ARITH = 1 -DEFINES += -DD_ARITH_CODING_SUPPORTED -endif - -ifeq ($(WITH_JPEG7), 1) -JPEG_LIB_VERSION = 70 -endif -ifeq ($(WITH_JPEG8), 1) -JPEG_LIB_VERSION = 80 -endif -DEFINES += -DJPEG_LIB_VERSION=$(JPEG_LIB_VERSION) - -ifeq ($(WITH_MEM_SRCDST), 1) -DEFINES += -DMEM_SRCDST_SUPPORTED -endif - -################################################## -### SIMD ### -################################################## - -include $(CLEAR_VARS) - -ifeq ($(WITH_SIMD), 1) - -ifeq ($(SIMD_ARCH), arm) -LOCAL_SRC_FILES = simd/jsimd_arm_neon.S simd/jsimd_arm.c -LOCAL_ARM_NEON := true -endif - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/simd $(LOCAL_PATH)/android - -LOCAL_MODULE = simd - -include $(BUILD_STATIC_LIBRARY) - -endif # WITH_SIMD - -################################################## -### libjpeg ### -################################################## - -include $(CLEAR_VARS) - -LIBJPEG_SRC_FILES = jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c \ - jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ - jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c \ - jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c \ - jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c \ - jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c \ - jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c - -ifneq ($(WITH_SIMD), 1) -LIBJPEG_SRC_FILES += jsimd_none.c -endif - -ifeq ($(WITH_ARITH), 1) -LIBJPEG_SRC_FILES += jaricom.c -endif -ifeq ($(WITH_ARITH_ENC), 1) -LIBJPEG_SRC_FILES += jcarith.c -endif -ifeq ($(WITH_ARITH_DEC), 1) -LIBJPEG_SRC_FILES += jdarith.c -endif - -LOCAL_SRC_FILES := ${LIBJPEG_SRC_FILES} - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -ifeq ($(WITH_SIMD), 1) -LOCAL_STATIC_LIBRARIES = libsimd -endif -LOCAL_MODULE = jpeg -include $(BUILD_SHARED_LIBRARY) - -################################################## -### libturbojpeg ### -################################################## - -ifeq ($(WITH_TURBOJPEG), 1) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := ${LIBJPEG_SRC_FILES} turbojpeg.c transupp.c jdatadst-tj.c \ - jdatasrc-tj.c turbojpeg-jni.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -ifeq ($(WITH_SIMD), 1) -LOCAL_STATIC_LIBRARIES = libsimd -endif -LOCAL_MODULE = turbojpeg -include $(BUILD_SHARED_LIBRARY) - -endif # WITH_TURBOJPEG - -###################################################### -### cjpeg ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = cdjpeg.c cjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c \ - rdtarga.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) -DBMP_SUPPORTED -DGIF_SUPPORTED \ - -DPPM_SUPPORTED -DTARGA_SUPPORTED - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = cjpeg -include $(BUILD_EXECUTABLE) - -###################################################### -### djpeg ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = cdjpeg.c djpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c \ - wrppm.c wrtarga.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) -DBMP_SUPPORTED -DGIF_SUPPORTED \ - -DPPM_SUPPORTED -DTARGA_SUPPORTED - -LOCAL_SHARED_LIBRARIES = libjpeg - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = djpeg -include $(BUILD_EXECUTABLE) - -###################################################### -### jpegtran ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = jpegtran.c rdswitch.c cdjpeg.c transupp.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = jpegtran -include $(BUILD_EXECUTABLE) - -###################################################### -### rdjpgcom ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = rdjpgcom.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = rdjpgcom -include $(BUILD_EXECUTABLE) - -###################################################### -### wrjpgcom ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = wrjpgcom.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libjpeg -LOCAL_MODULE = wrjpgcom -include $(BUILD_EXECUTABLE) - -###################################################### -### tjunittest ### -###################################################### - -ifeq ($(WITH_TURBOJPEG), 1) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = tjunittest.c tjutil.c - -LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libturbojpeg -LOCAL_MODULE = tjunittest -include $(BUILD_EXECUTABLE) - -###################################################### -### tjbench ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c wrppm.c - -LOCAL_CFLAGS = $(DEFINES) -DBMP_SUPPORTED -DPPM_SUPPORTED - -LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android - -LOCAL_SHARED_LIBRARIES = libturbojpeg -LOCAL_MODULE = tjbench -include $(BUILD_EXECUTABLE) - -endif # WITH_TURBOJPEG - -###################################################### -### md5cmp ### -###################################################### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES = md5/md5cmp.c md5/md5.c md5/md5hl.c - -LOCAL_MODULE = md5cmp -include $(BUILD_EXECUTABLE) - -endif # TARGET_SIMULATOR != true diff --git a/BUILDING.txt b/BUILDING.txt index d40c2709..13835a1f 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -319,7 +319,7 @@ This release of libjpeg-turbo can use ARM NEON SIMD instructions to accelerate JPEG compression/decompression by approximately 2-4x on ARMv7 and later platforms. If libjpeg-turbo is configured on an ARM Linux platform, then the build system will automatically include the NEON SIMD routines, if they are -supported. +supported. Build instructions for other ARM-based platforms follow. Building libjpeg-turbo for iOS @@ -393,6 +393,45 @@ described above. Otherwise, you may get a libtool error such as "unable to infer tagged configuration." +Building libjpeg-turbo for Android +---------------------------------- + +Building libjpeg-turbo for Android platforms requires the Android NDK +(https://developer.android.com/tools/sdk/ndk) and autotools. The following is +a general recipe script that can be modified for your specific needs. + + # Set these variables to suit your needs + NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/ndk} + BUILD_PLATFORM={the platform name for the NDK package you installed-- + for example, "windows-x86" or "linux-x86_64"} + TOOLCHAIN_VERSION={"4.6", "4.8", etc. This corresponds to a toolchain + directory under ${NDK_PATH}/toolchains/.} + ANDROID_VERSION={The minimum version of Android to support-- for example, + "9", "19", etc.} + + HOST=arm-linux-androideabi + TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM} + SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm + ANDROID_INCLUDES="-I${SYSROOT}/usr/include -I${TOOLCHAIN}/include" + ANDROID_CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \ + -fstrict-aliasing --sysroot=${SYSROOT}" + export CPP=${TOOLCHAIN}/bin/${HOST}-cpp + export AR=${TOOLCHAIN}/bin/${HOST}-ar + export AS=${TOOLCHAIN}/bin/${HOST}-as + export NM=${TOOLCHAIN}/bin/${HOST}-nm + export CC=${TOOLCHAIN}/bin/${HOST}-gcc + export LD=${TOOLCHAIN}/bin/${HOST}-ld + export RANLIB=${TOOLCHAIN}/bin/${HOST}-ranlib + export OBJDUMP=${TOOLCHAIN}/bin/${HOST}-objdump + export STRIP=${TOOLCHAIN}/bin/${HOST}-strip + cd {build_directory} + sh {source_directory}/configure --host=${HOST} \ + CFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS} -O3" \ + CPPFLAGS="${ANDROID_INCLUDES} ${ANDROID_CFLAGS}" \ + LDFLAGS="${ANDROID_CFLAGS}" --with-simd ${1+"$@"} + make + + ******************************************************************************* ** Building on Windows (Visual C++ or MinGW) ******************************************************************************* diff --git a/android/jconfig.h b/android/jconfig.h deleted file mode 100644 index 568d58a1..00000000 --- a/android/jconfig.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if your compiler supports prototypes */ -#define HAVE_PROTOTYPES 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDDEF_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if the system has the type `unsigned char'. */ -#define HAVE_UNSIGNED_CHAR 1 - -/* Define to 1 if the system has the type `unsigned short'. */ -#define HAVE_UNSIGNED_SHORT 1 - -/* Compiler does not support pointers to undefined structures. */ -/* #undef INCOMPLETE_TYPES_BROKEN */ - -/* Define if you have BSD-like bzero and bcopy in rather than - memset/memcpy in . */ -/* #undef NEED_BSD_STRINGS */ - -/* Define if linker requires that the first 15 characters of global names be - unique. */ -/* #undef NEED_SHORT_EXTERNAL_NAMES */ - -/* Define if you need to include to get size_t. */ -#define NEED_SYS_TYPES_H 1 - -/* Define if your (broken) compiler shifts signed values as if they were - unsigned. */ -/* #undef RIGHT_SHIFT_IS_UNSIGNED */ - -/* Define to 1 if type `char' is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -/* # undef __CHAR_UNSIGNED__ */ -#endif - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ diff --git a/android/jconfigint.h b/android/jconfigint.h deleted file mode 100644 index a54554ea..00000000 --- a/android/jconfigint.h +++ /dev/null @@ -1,2 +0,0 @@ -/* How to obtain function inlining. */ -#define INLINE inline __attribute__((always_inline))