project build/ diff --git a/core/combo/linux-arm.mk b/core/combo/linux-arm.mk index edd2df4..8aaaeab 100644 --- a/core/combo/linux-arm.mk +++ b/core/combo/linux-arm.mk @@ -46,18 +46,31 @@ ifneq ($(wildcard $($(combo_target)CC)),) $(combo_target)LIBGCC := $(shell $($(combo_target)CC) -mthumb-interwork -print-libgcc-file-name) endif +ifeq ($(TARGET_ARCH),arm) + TARGET_ARCH_VERSION ?= armv5te +endif + $(combo_target)GLOBAL_CFLAGS += \ - -march=armv5te -mtune=xscale \ -msoft-float -fpic \ -mthumb-interwork \ -ffunction-sections \ -funwind-tables \ -fstack-protector \ -fno-short-enums \ - -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \ - -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \ -include $(call select-android-config-h,linux-arm) +ifneq ($(TARGET_ARCH_VERSION),armv4t) +$(combo_target)GLOBAL_CFLAGS += \ + -march=armv5te -mtune=xscale \ + -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \ + -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ +else +$(combo_target)GLOBAL_CFLAGS += \ + -march=armv4t -mtune=arm920t \ + -D__ARM_ARCH_4__ -D__ARM_ARCH_4T__ +endif + + $(combo_target)GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden $(combo_target)RELEASE_CFLAGS := \ diff --git a/core/envsetup.mk b/core/envsetup.mk index 31901e9..366b5af 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -329,6 +329,7 @@ $(info TARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)) $(info TARGET_SIMULATOR=$(TARGET_SIMULATOR)) $(info TARGET_BUILD_TYPE=$(TARGET_BUILD_TYPE)) $(info TARGET_ARCH=$(TARGET_ARCH)) +$(info TARGET_ARCH_VERSION=$(TARGET_ARCH_VERSION)) $(info HOST_ARCH=$(HOST_ARCH)) $(info HOST_OS=$(HOST_OS)) $(info HOST_BUILD_TYPE=$(HOST_BUILD_TYPE)) diff --git a/core/main.mk b/core/main.mk index 2c7bb78..d9cfec9 100644 --- a/core/main.mk +++ b/core/main.mk @@ -197,7 +197,7 @@ ifneq (,$(user_variant)) else # !user_variant # Turn on checkjni for non-user builds. - ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1 + ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=0 # Set device insecure for non-user builds. ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 # Allow mock locations by default for non user builds project dalvik/ diff --git a/vm/Android.mk b/vm/Android.mk index f3eed3f..48b0100 100644 --- a/vm/Android.mk +++ b/vm/Android.mk @@ -232,9 +232,16 @@ ifeq ($(TARGET_ARCH),arm) arch/arm/CallEABI.S \ arch/arm/HintsEABI.c # TODO: select sources for ARMv4 vs. ARMv5TE +ifeq ($(TARGET_ARCH_VERSION),armv5te) LOCAL_SRC_FILES += \ mterp/out/InterpC-armv5te.c.arm \ mterp/out/InterpAsm-armv5te.S +endif +ifeq ($(TARGET_ARCH_VERSION),armv4t) + LOCAL_SRC_FILES += \ + mterp/out/InterpC-armv4t.c.arm \ + mterp/out/InterpAsm-armv4t.S +endif LOCAL_SHARED_LIBRARIES += libdl else ifeq ($(TARGET_ARCH),x86) diff --git a/vm/arch/arm/CallEABI.S b/vm/arch/arm/CallEABI.S index a98473f..4ba5403 100644 --- a/vm/arch/arm/CallEABI.S +++ b/vm/arch/arm/CallEABI.S @@ -239,7 +239,12 @@ DBG strcs ip, [r8] @ DEBUG DEBUG @ call the method ldr ip, [r4, #8] @ func +#ifndef __ARM_ARCH_4T__ blx ip +#else + mov lr, pc + bx ip +#endif @ We're back, result is in r0 or (for long/double) r0-r1. @ project external/opencore/ diff --git a/Config.mk b/Config.mk index 2334eab..6c15bdc 100644 --- a/Config.mk +++ b/Config.mk @@ -12,7 +12,11 @@ ifeq ($(ENABLE_PV_LOGGING),1) endif ifeq ($(TARGET_ARCH),arm) - PV_CFLAGS += -DPV_ARM_GCC_V5 +ifeq ($(TARGET_ARCH_VERSION),armv4t) + PV_CFLAGS += -DPV_ARM_GCC_V4 -D_ARM_V4_GCC +else + PV_CFLAGS += -DPV_ARM_GCC_V5 -D_ARM_V5_GCC +endif endif # HAS_OSCL_LIB_SUPPORT turns on PV's OSCL dynamic loader. diff --git a/codecs_v2/audio/aac/dec/src/pv_normalize.cpp b/codecs_v2/audio/aac/dec/src/pv_normalize.cpp index 365b5ad..c6f0439 100644 --- a/codecs_v2/audio/aac/dec/src/pv_normalize.cpp +++ b/codecs_v2/audio/aac/dec/src/pv_normalize.cpp @@ -98,7 +98,7 @@ Returns ----------------------------------------------------------------------------*/ #if defined(_ARM) -#elif (defined(PV_ARM_GCC_V5)||defined(PV_ARM_GCC_V4)) +#elif defined(PV_ARM_GCC_V5) /* function is inlined in header file */ diff --git a/codecs_v2/audio/aac/dec/src/pv_normalize.h b/codecs_v2/audio/aac/dec/src/pv_normalize.h index dce080e..37f554e 100644 --- a/codecs_v2/audio/aac/dec/src/pv_normalize.h +++ b/codecs_v2/audio/aac/dec/src/pv_normalize.h @@ -68,7 +68,7 @@ __inline Int pv_normalize(Int32 x) } -#elif (defined(PV_ARM_GCC_V5)||defined(PV_ARM_GCC_V4)) +#elif defined(PV_ARM_GCC_V5) __inline Int pv_normalize(Int32 x) { diff --git a/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h b/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h index f6c80e2..f7d2a1b 100644 --- a/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h +++ b/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op.h @@ -71,7 +71,15 @@ terms listed above has been obtained from the copyright holder. #elif defined(PV_ARM_GCC_V5) #include "basic_op_arm_gcc_v5.h" -#else +/* +#elif defined(PV_ARM_V4) +#include "basic_op_arm_v4.h" + +#elif defined(PV_ARM_GCC_V4) +#include "basic_op_arm_gcc_v4.h" +*/ + +#else #include "basic_op_c_equivalent.h" #endif diff --git a/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h b/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h index 533b105..908dd6a 100644 --- a/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h +++ b/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h @@ -101,7 +101,7 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) +#if defined(__ARM_ARCH_4T__) || !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) /* C EQUIVALENT */ Word16 norm_l(Word32 L_var1); diff --git a/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h b/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h index 2e37a9f..b243cef 100644 --- a/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h +++ b/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_s.h @@ -99,7 +99,7 @@ extern "C" ; GLOBAL FUNCTION DEFINITIONS ; Function Prototype declaration ----------------------------------------------------------------------------*/ -#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) +#if defined(__ARM_ARCH_4T__) || !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) /* C EQUIVALENT */ diff --git a/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp b/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp index 132fed6..bad1e34 100644 --- a/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp +++ b/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp @@ -196,7 +196,7 @@ Word16 norm_l (Word32 L_var1) /*---------------------------------------------------------------------------- ; FUNCTION CODE ----------------------------------------------------------------------------*/ -#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) +#if defined(__ARM_ARCH_4T__) || !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) Word16 norm_l(register Word32 L_var1) { /*---------------------------------------------------------------------------- diff --git a/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp b/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp index 8cdcdb8..9078c12 100644 --- a/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp +++ b/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp @@ -192,7 +192,7 @@ Word16 norm_s (Word16 var1) /*---------------------------------------------------------------------------- ; FUNCTION CODE ----------------------------------------------------------------------------*/ -#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) +#if defined(__ARM_ARCH_4T__) || !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) ) Word16 norm_s(register Word16 var1) { diff --git a/codecs_v2/audio/mp3/dec/Android.mk b/codecs_v2/audio/mp3/dec/Android.mk index 26e69b0..22fb5eb 100644 --- a/codecs_v2/audio/mp3/dec/Android.mk +++ b/codecs_v2/audio/mp3/dec/Android.mk @@ -34,12 +34,14 @@ LOCAL_SRC_FILES := \ src/pvmp3_dct_16.cpp ifeq ($(TARGET_ARCH),arm) +ifneq ($(TARGET_ARCH_VERSION),armv4t) LOCAL_SRC_FILES += \ src/asm/pvmp3_polyphase_filter_window_gcc.s \ src/asm/pvmp3_mdct_18_gcc.s \ src/asm/pvmp3_dct_9_gcc.s \ src/asm/pvmp3_dct_16_gcc.s endif +endif LOCAL_MODULE := libpvmp3 diff --git a/codecs_v2/audio/mp3/dec/src/pvmp3_dct_16.cpp b/codecs_v2/audio/mp3/dec/src/pvmp3_dct_16.cpp index a71efc4..da16468 100644 --- a/codecs_v2/audio/mp3/dec/src/pvmp3_dct_16.cpp +++ b/codecs_v2/audio/mp3/dec/src/pvmp3_dct_16.cpp @@ -90,7 +90,7 @@ Input ------------------------------------------------------------------------------ */ -#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) ) +#if ( !defined(PV_ARM_GCC_V5) ) /*---------------------------------------------------------------------------- ; INCLUDES ----------------------------------------------------------------------------*/ diff --git a/codecs_v2/audio/mp3/dec/src/pvmp3_dct_9.cpp b/codecs_v2/audio/mp3/dec/src/pvmp3_dct_9.cpp index ce3ec64..fca7daa 100644 --- a/codecs_v2/audio/mp3/dec/src/pvmp3_dct_9.cpp +++ b/codecs_v2/audio/mp3/dec/src/pvmp3_dct_9.cpp @@ -58,7 +58,7 @@ Returns ------------------------------------------------------------------------------ */ -#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) && !defined(PV_ARM_V5) && !defined(PV_ARM_V4) ) +#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_V5) ) /*---------------------------------------------------------------------------- ; INCLUDES ----------------------------------------------------------------------------*/ diff --git a/codecs_v2/audio/mp3/dec/src/pvmp3_mdct_18.cpp b/codecs_v2/audio/mp3/dec/src/pvmp3_mdct_18.cpp index 09a735b..d49cbeb 100644 --- a/codecs_v2/audio/mp3/dec/src/pvmp3_mdct_18.cpp +++ b/codecs_v2/audio/mp3/dec/src/pvmp3_mdct_18.cpp @@ -63,7 +63,7 @@ Returns ------------------------------------------------------------------------------ */ -#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) && !defined(PV_ARM_V5) && !defined(PV_ARM_V4) ) +#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_V5) ) /*---------------------------------------------------------------------------- ; INCLUDES ----------------------------------------------------------------------------*/ diff --git a/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.cpp b/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.cpp index e579bbd..f18b0d5 100644 --- a/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.cpp +++ b/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.cpp @@ -102,7 +102,7 @@ Returns ----------------------------------------------------------------------------*/ #if (defined(PV_ARM_V5)||defined(PV_ARM_V4)) -#elif (defined(PV_ARM_GCC_V5)||defined(PV_ARM_GCC_V4)) +#elif defined(PV_ARM_GCC_V5) /* function is inlined in header file */ diff --git a/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.h b/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.h index 5471771..455e039 100644 --- a/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.h +++ b/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.h @@ -71,7 +71,7 @@ __inline int32 pvmp3_normalize(int32 x) } -#elif (defined(PV_ARM_GCC_V5)||defined(PV_ARM_GCC_V4)) +#elif defined(PV_ARM_GCC_V5) __inline int32 pvmp3_normalize(int32 x) { diff --git a/codecs_v2/audio/mp3/dec/src/pvmp3_polyphase_filter_window.cpp b/codecs_v2/audio/mp3/dec/src/pvmp3_polyphase_filter_window.cpp index 8380437..0b627eb 100644 --- a/codecs_v2/audio/mp3/dec/src/pvmp3_polyphase_filter_window.cpp +++ b/codecs_v2/audio/mp3/dec/src/pvmp3_polyphase_filter_window.cpp @@ -66,7 +66,7 @@ Input ------------------------------------------------------------------------------ */ -#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) && !defined(PV_ARM_V5) && !defined(PV_ARM_V4) ) +#if ( !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_V5) ) /*---------------------------------------------------------------------------- ; INCLUDES ----------------------------------------------------------------------------*/ diff --git a/codecs_v2/audio/mp3/dec/src/pvmp3_polyphase_filter_window.h b/codecs_v2/audio/mp3/dec/src/pvmp3_polyphase_filter_window.h index b9eccad..4027058 100644 --- a/codecs_v2/audio/mp3/dec/src/pvmp3_polyphase_filter_window.h +++ b/codecs_v2/audio/mp3/dec/src/pvmp3_polyphase_filter_window.h @@ -87,7 +87,7 @@ extern "C" #endif -#if (defined(PV_ARM_V5)||defined(PV_ARM_V4)) +#if (defined(PV_ARM_V5) ) __inline int16 saturate16(int32 sample) diff --git a/codecs_v2/video/m4v_h263/enc/src/dct_inline.h b/codecs_v2/video/m4v_h263/enc/src/dct_inline.h index 3a2affe..2c7285c 100644 --- a/codecs_v2/video/m4v_h263/enc/src/dct_inline.h +++ b/codecs_v2/video/m4v_h263/enc/src/dct_inline.h @@ -22,7 +22,7 @@ #ifndef _DCT_INLINE_H_ #define _DCT_INLINE_H_ -#if !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) +#if !defined(PV_ARM_GCC_V5) #include "oscl_base_macros.h" diff --git a/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h b/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h index 825543f..7b4a77f 100644 --- a/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h +++ b/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h @@ -26,7 +26,7 @@ #include "mp4def.h" #include "oscl_base_macros.h" -#if !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) /* ARM GNU COMPILER */ +#if ! ( defined(PV_ARM_GCC_V5) || defined(PV_ARM_GCC_V4) ) __inline int32 aan_scale(int32 q_value, int32 coeff, int32 round, int32 QPdiv2) { @@ -167,7 +167,9 @@ __inline int32 coeff_dequant_mpeg_intra(int32 q_value, int32 tmp) return q_value; } -#elif defined(__CC_ARM) /* only work with arm v5 */ +#else /* ! ( defined(PV_ARM_GCC_V5) || defined(PV_ARM_GCC_V4) ) */ + +#if defined(__CC_ARM) #if defined(__TARGET_ARCH_5TE) @@ -264,7 +266,7 @@ __inline int32 coeff_dequant_mpeg(int32 q_value, int32 stepsize, int32 QP, int32 } -#else // not ARMV5TE +#else /* defined(__TARGET_ARCH_5TE) */ __inline int32 aan_scale(int32 q_value, int32 coeff, int32 round, int32 QPdiv2) @@ -361,7 +363,7 @@ __inline int32 coeff_dequant_mpeg(int32 q_value, int32 stepsize, int32 QP, int32 } -#endif +#endif /* defined(__TARGET_ARCH_5TE) */ __inline int32 coeff_clip(int32 q_value, int32 ac_clip) { @@ -424,7 +426,9 @@ __inline int32 coeff_dequant_mpeg_intra(int32 q_value, int32 tmp) return q_value; } -#elif ( defined(PV_ARM_GCC_V4) || defined(PV_ARM_GCC_V5) ) /* ARM GNU COMPILER */ +#else /* __CC_ARM */ + +#if defined(PV_ARM_GCC_V5) __inline int32 aan_scale(int32 q_value, int32 coeff, int32 round, int32 QPdiv2) @@ -617,10 +621,206 @@ __inline int32 coeff_dequant_mpeg_intra(int32 q_value, int32 tmp) return out; } +#else /* defined(PV_ARM_GCC_V5) */ -#endif // Platform +#if defined(PV_ARM_GCC_V4) +__inline int32 aan_scale(int32 q_value, int32 coeff, + int32 round, int32 QPdiv2) +{ + register int32 out; + register int32 qv = q_value; + register int32 cf = coeff; + register int32 rr = round; + register int32 qp = QPdiv2; + + asm volatile( + "mla %0, %2, %1, %3\n\t" + "movs %0, %0, asr #16\n\t" + "addle %0, %0, %4\n\t" + "subgt %0, %0, %4" + : "=&r"(out) + : "r"(qv), "r"(cf), "r"(rr), "r"(qp) + ); + return out; +} -#endif //_FASTQUANT_INLINE_H_ +__inline int32 coeff_quant(int32 coeff, int32 q_scale, int32 shift) +{ + register int32 q_value; + register int32 cc = coeff; + register int32 qs = q_scale; + register int32 ss = shift; + + asm volatile( + "mul %0, %2, %1\n\t" + "mov %1, %0, asr %3\n\t" + "add %0, %1, %1, lsr #31" + : "=r"(q_value) + : "r"(cc), "r"(qs), "r"(ss) + ); + + return q_value; +} + + +__inline int32 coeff_dequant(int32 q_value, int32 QPx2, int32 Addition, int32 tmp) +{ + register int32 coeff; + register int32 qv = q_value; + register int32 qp = QPx2; + register int32 aa = Addition; + register int32 tt = tmp; + + asm volatile( + "cmp %1, #0\n\t" + "mul %0, %1, %2\n\t" + "sublt %0, %0, %3\n\t" + "addge %0, %0, %3\n\t" + "add %1, %0, %4\n\t" + "subs %1, %1, #3840\n\t" + "subcss %1, %1, #254\n\t" + "subcss %0, %4, %0, asr #31" + : "=&r"(coeff) + : "r"(qv), "r"(qp), "r"(aa), "r"(tt) + ); + return coeff; +} + +__inline int32 smlabb(int32 q_value, int32 coeff, int32 round) +{ + register int32 out; + register int32 qv = q_value; + register int32 cc = coeff; + register int32 rr = round; + + asm volatile( + "mla %0, %2, %1, %3" + : "=&r"(out) + : "r"(qv), "r"(cc), "r"(rr) + ); + + return out; +} + +__inline int32 smulbb(int32 q_scale, int32 coeff) +{ + register int32 out; + register int32 qs = q_scale; + register int32 cc = coeff; + + asm volatile( + "mul %0, %1, %2" + : "=&r"(out) + : "r"(qs), "r"(cc) + ); + + return out; +} + + +__inline int32 coeff_dequant_mpeg(int32 q_value, int32 stepsize, int32 QP, int32 tmp) +{ + /* tmp must have value of 2047 */ + register int32 coeff; + register int32 qv = q_value; + register int32 ss = stepsize; + register int32 qp = QP; + register int32 tt = tmp; + + asm volatile( + "movs %1, %0, lsl #1\n\t" + "mul %2, %2, %3\n\t" + "addgt %1, %1, #1\n\t" + "sublt %1, %1, #1\n\t" + "mul %0, %1, %2\n\t" + "addlt %0, %0, #15\n\t" + "mov %0, %0, asr #4\n\t" + "add %1, %0, %4\n\t" + "subs %1, %1, #0xf00\n\t" + "subcss %1, %1, #0xfe\n\t" + "eorhi %0, %4, %0, asr #31" + : "+r"(qv) + : "r"(coeff), "r"(ss), "r"(qp), "r"(tt) + ); + return qv; +} + +#endif /* defined(PV_ARM_GCC_V4) */ + +__inline int32 coeff_clip(int32 q_value, int32 ac_clip) +{ + register int32 coeff; + register int32 qv = q_value; + register int32 aa = ac_clip; + + asm volatile( + "add %1, %0, %2\n\t" + "subs %1, %1, %2, lsl #1\n\t" + "eorhi %0, %2, %0, asr #31" + : "+r"(qv) + : "r"(coeff), "r"(aa) + ); + + return qv; +} + +__inline int32 aan_dc_scale(int32 coeff, int32 QP) +{ + register int32 cc = coeff; + register int32 qp = QP; + + asm volatile( + "cmp %0, #0\n\t" + "addle %0, %0, %1, asr #1\n\t" + "subgt %0, %0, %1, asr #1" + : "+r"(cc) + : "r"(qp) + ); + return cc; +} + +__inline int32 clip_2047(int32 q_value, int32 tmp) +{ + /* tmp must have value of 2047 */ + register int32 coeff; + register int32 qv = q_value; + register int32 tt = tmp; + + asm volatile( + "add %1, %0, %2\n\t" + "subs %1, %1, #0xf00\n\t" + "subcss %1, %1, #0xfe\n\t" + "eorhi %0, %2, %0, asr #31" + : "+r"(qv) + : "r"(coeff), "r"(tt) + ); + + return qv; +} + +__inline int32 coeff_dequant_mpeg_intra(int32 q_value, int32 tmp) +{ + register int32 coeff; + register int32 qv = q_value; + register int32 tt = tmp; + asm volatile( + "movs %0, %0, lsl #1\n\t" + "addlt %0, %0, #15\n\t" + "mov %0, %0, asr #4\n\t" + "add %1, %0, %2\n\t" + "subs %1, %1, #0xf00\n\t" + "subcss %1, %1, #0xfe\n\t" + "eorhi %0, %2, %0, asr #31" + : "+r"(qv) + : "r"(coeff), "r"(tt) + ); + + return qv; +} +#endif /* defined(PV_ARM_GCC_V5) */ +#endif /* __CC_ARM */ +#endif /* ! ( defined(PV_ARM_GCC_V5) || defined(PV_ARM_GCC_V4) ) */ +#endif /* _FASTQUANT_INLINE_H_ */ diff --git a/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h b/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h index a2f4934..b35a2cb 100644 --- a/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h +++ b/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h @@ -18,7 +18,7 @@ #ifndef _VLC_ENCODE_INLINE_H_ #define _VLC_ENCODE_INLINE_H_ -#if !defined(PV_ARM_GCC_V5) && !defined(PV_ARM_GCC_V4) +#if !defined(PV_ARM_GCC_V5) && defined(PV_ARM_GCC_V4) __inline Int zero_run_search(UInt *bitmapzz, Short *dataBlock, RunLevelBlock *RLB, Int nc) { @@ -209,7 +209,7 @@ __inline Int zero_run_search(UInt *bitmapzz, Short *dataBlock, RunLevelBlock *R return idx; } -#elif ( defined(PV_ARM_GCC_V4) || defined(PV_ARM_GCC_V5) ) /* ARM GNU COMPILER */ +#elif defined(PV_ARM_GCC_V5) /* ARM GNU COMPILER */ __inline Int m4v_enc_clz(UInt temp) { diff --git a/tools_v2/build/make/android_make_extras.mk b/tools_v2/build/make/android_make_extras.mk index fd425e6..cfd9438 100644 --- a/tools_v2/build/make/android_make_extras.mk +++ b/tools_v2/build/make/android_make_extras.mk @@ -134,7 +134,11 @@ $1: FORCE $$(quiet) echo "endif" >> $$@ $$(quiet) echo "" >> $$@ $$(quiet) echo "ifeq ($$(esc_dollar)(TARGET_ARCH),arm)" >> $$@ - $$(quiet) echo " PV_CFLAGS += -DPV_ARM_GCC_V5" >> $$@ + $$(quiet) echo " ifneq ($$(esc_dollar)(TARGET_ARCH_VERSION),armv4t)" >> $$@ + $$(quiet) echo " PV_CFLAGS += -DPV_ARM_GCC_V4" >> $$@ + $$(quiet) echo " else" >> $$@ + $$(quiet) echo " PV_CFLAGS += -DPV_ARM_GCC_V5" >> $$@ + $$(quiet) echo " endif" >> $$@ $$(quiet) echo "endif" >> $$@ $$(quiet) echo "" >> $$@ $$(quiet) echo "include $$(esc_dollar)(CLEAR_VARS)" >> $$@ @@ -220,7 +224,7 @@ $(ANDROID_MAKE_NAMES): ANDROID_CPP_SRCS := $(if $(strip $(SRCS)),$(patsubst %,$( $(ANDROID_MAKE_NAMES): ANDROID_ASM_SRCS := $(if $(strip $(SRCS)),$(patsubst %,$(call go_up_two_levels,$(SRCDIR))/%,$(filter-out %.cpp,$(SRCS))),) $(ANDROID_MAKE_NAMES): ANDROID_TARGET := $(if $(strip $(filter prog,$(TARGET_TYPE))),"LOCAL_MODULE :=" $(TARGET),$(if $(strip $(TARGET)),"LOCAL_MODULE :=" lib$(TARGET),)) $(ANDROID_MAKE_NAMES): ANDROID_HDRS := $(patsubst %,$(call go_up_two_levels,$(INCSRCDIR))/%,$(HDRS)) -$(ANDROID_MAKE_NAMES): ANDROID_C_FLAGS := $(filter-out %PV_ARM_GCC_V5,$(XCPPFLAGS)) +$(ANDROID_MAKE_NAMES): ANDROID_C_FLAGS := $(filter-out %PV_ARM_GCC_V5,$(XCPPFLAGS)) $(filter-out %PV_ARM_GCC_V4,$(XCPPFLAGS)) $(ANDROID_MAKE_NAMES): ANDROID_C_INC := $(ANDROID_TMP_LOCAL_INC) $(ANDROID_MAKE_NAMES): ANDROID_ARM_MODE := $(AND_LOCAL_ARM_MODE) $(ANDROID_MAKE_NAMES): ANDROID_MAKE_TYPE := $(if $(strip $(filter prog,$(TARGET_TYPE))),BUILD_EXECUTABLE,$(if $(strip $(SRCS)),BUILD_STATIC_LIBRARY,BUILD_COPY_HEADERS)) diff --git a/tools_v2/build/make/platforms/android.mk b/tools_v2/build/make/platforms/android.mk index 3a7b908..4f331b1 100644 --- a/tools_v2/build/make/platforms/android.mk +++ b/tools_v2/build/make/platforms/android.mk @@ -12,8 +12,12 @@ AR := arm-eabi-ar # overwrite RANLIB set in linux.mk export RANLIB := arm-eabi-ranlib -# This toolchain supports linux-arm v5 +# This toolchain supports linux-arm v4/v5 +ifeq ($(TARGET_ARCH_VERSION),armv4t) +DEFAULT_CPP_ASM_FLAGS := -DPV_ARM_GCC_V4 +else DEFAULT_CPP_ASM_FLAGS := -DPV_ARM_GCC_V5 +endif PROCESSOR := arm # include the common engine header files in the search path diff --git a/tools_v2/build/make/platforms/linux_arm.mk b/tools_v2/build/make/platforms/linux_arm.mk index 38767e2..fa2a532 100644 --- a/tools_v2/build/make/platforms/linux_arm.mk +++ b/tools_v2/build/make/platforms/linux_arm.mk @@ -9,8 +9,12 @@ STRIP := arm-linux-strip # overwrite RANLIB set in linux.mk export RANLIB = arm-linux-ranlib -# This toolchain supports linux-arm v5 +# This toolchain supports linux-arm v4/v5 +ifeq ($(TARGET_ARCH_VERSION),armv4t) +DEFAULT_CPP_ASM_FLAGS := -DPV_ARM_GCC_V4 +else DEFAULT_CPP_ASM_FLAGS := -DPV_ARM_GCC_V5 +endif PROCESSOR := arm # include the common engine header files in the search path project external/openssl/ diff --git a/crypto/Android.mk b/crypto/Android.mk index 0b2aa9e..72fb9aa 100644 --- a/crypto/Android.mk +++ b/crypto/Android.mk @@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) ifeq ($(TARGET_ARCH),arm) - LOCAL_CFLAGS += -DOPENSSL_BN_ASM_MONT -DAES_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM +# LOCAL_CFLAGS += -DOPENSSL_BN_ASM_MONT -DAES_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -O2 + LOCAL_CFLAGS += -DOPENSSL_BN_ASM_MONT -DAES_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -O2 -DOPENSSL_NO_MD LOCAL_SRC_FILES:= 0.9.9-dev/bn/armv4-mont.s \ 0.9.9-dev/aes/aes-armv4.s \ 0.9.9-dev/sha/sha1-armv4-large.s \ project external/skia/ diff --git a/Android.mk b/Android.mk index 8afd5af..6eed115 100644 --- a/Android.mk +++ b/Android.mk @@ -184,10 +184,12 @@ LOCAL_SRC_FILES += \ # including the optimized assembly code for the src-overing operation ifeq ($(TARGET_ARCH),arm) +ifneq ($(TARGET_ARCH_VERSION),armv4t) LOCAL_CFLAGS += -DUSE_ARM_ASM LOCAL_SRC_FILES += \ src/core/asm/s32a_d565_opaque.S endif +endif LOCAL_SHARED_LIBRARIES := \ libcutils \ diff --git a/include/core/SkMath.h b/include/core/SkMath.h index 0c89065..076bfe7 100644 --- a/include/core/SkMath.h +++ b/include/core/SkMath.h @@ -162,7 +162,7 @@ static inline int SkNextLog2(uint32_t value) { With this requirement, we can generate faster instructions on some architectures. */ -#if defined(__arm__) && !defined(__thumb__) && !defined(__ARM_ARCH_4__) +#if defined(__arm__) && !defined(__thumb__) && !defined(__ARM_ARCH_4__) && !defined(__ARM_ARCH_4T__) static inline int32_t SkMulS16(S16CPU x, S16CPU y) { SkASSERT((int16_t)x == x); SkASSERT((int16_t)y == y); project external/sonivox/ diff --git a/arm-wt-22k/Android.mk b/arm-wt-22k/Android.mk index 71fbcf8..5f7adf4 100644 --- a/arm-wt-22k/Android.mk +++ b/arm-wt-22k/Android.mk @@ -75,6 +75,7 @@ LOCAL_COPY_HEADERS := \ host_src/jet.h ifeq ($(TARGET_ARCH),arm) +ifneq ($(TARGET_ARCH_VERSION),armv4t) LOCAL_SRC_FILES+= \ lib_src/ARM-E_filter_gnu.s \ lib_src/ARM-E_interpolate_loop_gnu.s \ @@ -94,6 +95,7 @@ LOCAL_CFLAGS+= -D NATIVE_EAS_KERNEL \ LOCAL_COPY_HEADERS += lib_src/ARM_synth_constants_gnu.inc endif +endif LOCAL_SHARED_LIBRARIES := \ libutils libcutils diff --git a/arm-wt-22k/lib_src/eas_mixer.c b/arm-wt-22k/lib_src/eas_mixer.c index c4a2f9f..89e357a 100644 --- a/arm-wt-22k/lib_src/eas_mixer.c +++ b/arm-wt-22k/lib_src/eas_mixer.c @@ -8,18 +8,18 @@ * must be optimized for best performance. * * Copyright Sonic Network Inc. 2005 - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * *---------------------------------------------------------------------------- * Revision Control: @@ -250,7 +250,7 @@ void EAS_MixEnginePost (S_EAS_DATA *pEASData, EAS_I32 numSamples) } -#ifndef NATIVE_EAS_KERNEL +#if !defined(NATIVE_EAS_KERNEL) || defined (__ARM_ARCH_4T__) /*---------------------------------------------------------------------------- * SynthMasterGain *---------------------------------------------------------------------------- diff --git a/arm-wt-22k/lib_src/eas_wtengine.c b/arm-wt-22k/lib_src/eas_wtengine.c index dd46f22..4ff742d 100644 --- a/arm-wt-22k/lib_src/eas_wtengine.c +++ b/arm-wt-22k/lib_src/eas_wtengine.c @@ -57,7 +57,7 @@ extern void WT_Interpolate (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame); extern void WT_VoiceFilter (S_FILTER_CONTROL*pFilter, S_WT_INT_FRAME *pWTIntFrame); #endif -#if defined(_OPTIMIZED_MONO) || !defined(NATIVE_EAS_KERNEL) +#if defined(_OPTIMIZED_MONO) || !defined(NATIVE_EAS_KERNEL) || defined(__ARM_ARCH_4T__) /*---------------------------------------------------------------------------- * WT_VoiceGain *---------------------------------------------------------------------------- @@ -155,7 +155,7 @@ void WT_VoiceGain (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) } #endif -#ifndef NATIVE_EAS_KERNEL +#if !defined(NATIVE_EAS_KERNEL) || defined(__ARM_ARCH_4T__) /*---------------------------------------------------------------------------- * WT_Interpolate *---------------------------------------------------------------------------- @@ -249,7 +249,7 @@ void WT_Interpolate (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) } #endif -#ifndef NATIVE_EAS_KERNEL +#if !defined(NATIVE_EAS_KERNEL) || defined(__ARM_ARCH_4T__) /*---------------------------------------------------------------------------- * WT_InterpolateNoLoop *---------------------------------------------------------------------------- @@ -336,7 +336,7 @@ void WT_InterpolateNoLoop (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) } #endif -#if defined(_FILTER_ENABLED) && !defined(NATIVE_EAS_KERNEL) +#if defined(_FILTER_ENABLED) && ( !defined(NATIVE_EAS_KERNEL) || defined(__ARM_ARCH_4T__) ) /*---------------------------------------------------------------------------- * WT_VoiceFilter *---------------------------------------------------------------------------- project frameworks/base/ diff --git a/libs/audioflinger/AudioMixer.cpp b/libs/audioflinger/AudioMixer.cpp index b02efcc..de3a8a8 100644 --- a/libs/audioflinger/AudioMixer.cpp +++ b/libs/audioflinger/AudioMixer.cpp @@ -401,7 +401,7 @@ void AudioMixer::process__validate(state_t* state, void* output) static inline int32_t mulAdd(int16_t in, int16_t v, int32_t a) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && !defined(__thumb__) && !defined(__ARM_ARCH_4T__) int32_t out; asm( "smlabb %[out], %[in], %[v], %[a] \n" : [out]"=r"(out) @@ -416,7 +416,7 @@ int32_t mulAdd(int16_t in, int16_t v, int32_t a) static inline int32_t mul(int16_t in, int16_t v) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && !defined(__thumb__) && !defined(__ARM_ARCH_4T__) int32_t out; asm( "smulbb %[out], %[in], %[v] \n" : [out]"=r"(out) @@ -431,7 +431,7 @@ int32_t mul(int16_t in, int16_t v) static inline int32_t mulAddRL(int left, uint32_t inRL, uint32_t vRL, int32_t a) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && !defined(__thumb__) && !defined(__ARM_ARCH_4T__) int32_t out; if (left) { asm( "smlabb %[out], %[inRL], %[vRL], %[a] \n" @@ -457,7 +457,7 @@ int32_t mulAddRL(int left, uint32_t inRL, uint32_t vRL, int32_t a) static inline int32_t mulRL(int left, uint32_t inRL, uint32_t vRL) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && !defined(__thumb__) && !defined(__ARM_ARCH_4T__) int32_t out; if (left) { asm( "smulbb %[out], %[inRL], %[vRL] \n" diff --git a/libs/audioflinger/AudioResamplerSinc.cpp b/libs/audioflinger/AudioResamplerSinc.cpp index 9e5e254..f2c9858 100644 --- a/libs/audioflinger/AudioResamplerSinc.cpp +++ b/libs/audioflinger/AudioResamplerSinc.cpp @@ -62,7 +62,7 @@ const int32_t AudioResamplerSinc::mFirCoefsDown[] = { static inline int32_t mulRL(int left, int32_t in, uint32_t vRL) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && !defined(__thumb__) && !defined(__ARM_ARCH_4T__) int32_t out; if (left) { asm( "smultb %[out], %[in], %[vRL] \n" @@ -88,7 +88,7 @@ int32_t mulRL(int left, int32_t in, uint32_t vRL) static inline int32_t mulAdd(int16_t in, int32_t v, int32_t a) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && !defined(__thumb__) && !defined(__ARM_ARCH_4T__) int32_t out; asm( "smlawb %[out], %[v], %[in], %[a] \n" : [out]"=r"(out) @@ -105,7 +105,7 @@ int32_t mulAdd(int16_t in, int32_t v, int32_t a) static inline int32_t mulAddRL(int left, uint32_t inRL, int32_t v, int32_t a) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && !defined(__thumb__) && !defined(__ARM_ARCH_4T__) int32_t out; if (left) { asm( "smlawb %[out], %[v], %[inRL], %[a] \n" project system/core/ diff --git a/libpixelflinger/Android.mk b/libpixelflinger/Android.mk index 50eb5f5..49a3029 100644 --- a/libpixelflinger/Android.mk +++ b/libpixelflinger/Android.mk @@ -6,11 +6,13 @@ include $(CLEAR_VARS) # ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv6) LOCAL_ASFLAGS := -march=armv6 LOCAL_SRC_FILES := rotate90CW_4x4_16v6.S LOCAL_MODULE := libpixelflinger_armv6 include $(BUILD_STATIC_LIBRARY) endif +endif # # C/C++ and ARMv5 objects @@ -40,8 +42,10 @@ PIXELFLINGER_SRC_FILES:= \ buffer.cpp ifeq ($(TARGET_ARCH),arm) +ifneq ($(TARGET_ARCH_VERSION),armv4t) PIXELFLINGER_SRC_FILES += t32cb16blend.S endif +endif ifeq ($(TARGET_ARCH),arm) # special optimization flags for pixelflinger @@ -71,8 +75,10 @@ LOCAL_SHARED_LIBRARIES += libhardware_legacy LOCAL_CFLAGS += -DWITH_LIB_HARDWARE endif ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv6) LOCAL_WHOLE_STATIC_LIBRARIES := libpixelflinger_armv6 endif +endif include $(BUILD_SHARED_LIBRARY) # @@ -84,8 +90,10 @@ LOCAL_MODULE:= libpixelflinger_static LOCAL_SRC_FILES := $(PIXELFLINGER_SRC_FILES) LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS) ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv6) LOCAL_WHOLE_STATIC_LIBRARIES := libpixelflinger_armv6 endif +endif include $(BUILD_STATIC_LIBRARY) diff --git a/libpixelflinger/scanline.cpp b/libpixelflinger/scanline.cpp index f700306..eb49ee6 100644 --- a/libpixelflinger/scanline.cpp +++ b/libpixelflinger/scanline.cpp @@ -1321,7 +1321,7 @@ void scanline_t32cb16blend(context_t* c) const int32_t v = (c->state.texture[0].shade.it0>>16) + y; uint32_t *src = reinterpret_cast(tex->data)+(u+(tex->stride*v)); -#if ((ANDROID_CODEGEN >= ANDROID_CODEGEN_ASM) && defined(__arm__)) +#if ((ANDROID_CODEGEN >= ANDROID_CODEGEN_ASM) && defined(__arm__) && !defined(__ARM_ARCH_4T__) ) scanline_t32cb16blend_arm(dst, src, ct); #else while (ct--) {