...
 
Commits (4)
...@@ -704,6 +704,9 @@ process_common_toolchain() { ...@@ -704,6 +704,9 @@ process_common_toolchain() {
*os2*) *os2*)
tgt_os=os2 tgt_os=os2
;; ;;
*qnx*)
tgt_os=qnx
;;
esac esac
if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then
...@@ -816,6 +819,72 @@ process_common_toolchain() { ...@@ -816,6 +819,72 @@ process_common_toolchain() {
;; ;;
esac esac
# Configure Android toolchain
case ${tgt_os} in
android*)
case ${tgt_isa} in
armv7)
ANDROID_TOOLCHAIN_PREFIX=arm-linux-androideabi
ANDROID_TOOLCHAIN_ARCH=arm
;;
x86)
ANDROID_TOOLCHAIN_PREFIX=x86-linux-android
ANDROID_TOOLCHAIN_ALT_PREFIX=x86_64-linux-android
ANDROID_TOOLCHAIN_ARCH=x86
;;
esac
SDK_PATH=${sdk_path}
COMPILER_LOCATION=`find "${SDK_PATH}" \
-name "${ANDROID_TOOLCHAIN_PREFIX}-gcc*" -print -quit`
if [ -z "${COMPILER_LOCATION}" ]; then
COMPILER_LOCATION=`find "${SDK_PATH}" \
-name "${ANDROID_TOOLCHAIN_ALT_PREFIX}-gcc*" -print -quit`
ANDROID_TOOLCHAIN_PREFIX=${ANDROID_TOOLCHAIN_ALT_PREFIX}
fi
TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/${ANDROID_TOOLCHAIN_PREFIX}-
CC=${TOOLCHAIN_PATH}gcc
CXX=${TOOLCHAIN_PATH}g++
AR=${TOOLCHAIN_PATH}ar
LD=${TOOLCHAIN_PATH}gcc
AS=${TOOLCHAIN_PATH}as
STRIP=${TOOLCHAIN_PATH}strip
NM=${TOOLCHAIN_PATH}nm
if [ -z "${alt_libc}" ]; then
alt_libc=`find "${SDK_PATH}" -name arch-${ANDROID_TOOLCHAIN_ARCH} -print | \
awk '{n = split($0,a,"/"); \
split(a[n-1],b,"-"); \
print $0 " " b[2]}' | \
sort -g -k 2 | \
awk '{ print $1 }' | tail -1`
fi
add_cflags "--sysroot=${alt_libc}"
add_ldflags "--sysroot=${alt_libc}"
if [ ${tgt_isa} = "armv7" ]; then
# linker flag that routes around a CPU bug in some
# Cortex-A8 implementations (NDK Dev Guide)
add_ldflags "-Wl,--fix-cortex-a8"
fi
enable_feature pic
soft_enable realtime_only
if [ ${tgt_isa} = "armv7" ]; then
soft_enable runtime_cpu_detect
fi
if enabled runtime_cpu_detect; then
add_cflags "-I${SDK_PATH}/sources/android/cpufeatures"
fi
if [ ${tgt_isa} = "x86" ]; then
add_asflags "-D__ANDROID__"
add_cflags "-D__ANDROID__"
fi
;;
esac
# Process ARM architecture variants # Process ARM architecture variants
case ${toolchain} in case ${toolchain} in
arm*) arm*)
...@@ -957,43 +1026,8 @@ EOF ...@@ -957,43 +1026,8 @@ EOF
disable_feature os_support disable_feature os_support
;; ;;
android*) qnx*)
SDK_PATH=${sdk_path} disable_feature multithread
COMPILER_LOCATION=`find "${SDK_PATH}" \
-name "arm-linux-androideabi-gcc*" -print -quit`
TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi-
CC=${TOOLCHAIN_PATH}gcc
CXX=${TOOLCHAIN_PATH}g++
AR=${TOOLCHAIN_PATH}ar
LD=${TOOLCHAIN_PATH}gcc
AS=${TOOLCHAIN_PATH}as
STRIP=${TOOLCHAIN_PATH}strip
NM=${TOOLCHAIN_PATH}nm
if [ -z "${alt_libc}" ]; then
alt_libc=`find "${SDK_PATH}" -name arch-arm -print | \
awk '{n = split($0,a,"/"); \
split(a[n-1],b,"-"); \
print $0 " " b[2]}' | \
sort -g -k 2 | \
awk '{ print $1 }' | tail -1`
fi
add_cflags "--sysroot=${alt_libc}"
add_ldflags "--sysroot=${alt_libc}"
# linker flag that routes around a CPU bug in some
# Cortex-A8 implementations (NDK Dev Guide)
add_ldflags "-Wl,--fix-cortex-a8"
enable_feature pic
soft_enable realtime_only
if [ ${tgt_isa} = "armv7" ]; then
soft_enable runtime_cpu_detect
fi
if enabled runtime_cpu_detect; then
add_cflags "-I${SDK_PATH}/sources/android/cpufeatures"
fi
;; ;;
darwin*) darwin*)
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#ifdef __ANDROID__
#define rand() lrand48()
#endif
#define RGB_TO_YUV(t) \ #define RGB_TO_YUV(t) \
( (0.257*(float)(t>>16)) + (0.504*(float)(t>>8&0xff)) + (0.098*(float)(t&0xff)) + 16), \ ( (0.257*(float)(t>>16)) + (0.504*(float)(t>>8&0xff)) + (0.098*(float)(t&0xff)) + 16), \
(-(0.148*(float)(t>>16)) - (0.291*(float)(t>>8&0xff)) + (0.439*(float)(t&0xff)) + 128), \ (-(0.148*(float)(t>>16)) - (0.291*(float)(t>>8&0xff)) + (0.439*(float)(t&0xff)) + 128), \
......