diff options
author | Mans Rullgard <mans@mansr.com> | 2011-04-05 17:43:01 +0300 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2012-01-13 21:16:13 +0200 |
commit | d55da5d452fa20c7c4c4172884e0983bbeb79b6d (patch) | |
tree | 9def1b5676d7394e4926345d6e47cbb7ec76e08b /media/libstagefright/codecs | |
parent | 5433616a0e44ac374b5d3cad9f3e1cc0fc9ad97a (diff) | |
download | frameworks_base-d55da5d452fa20c7c4c4172884e0983bbeb79b6d.zip frameworks_base-d55da5d452fa20c7c4c4172884e0983bbeb79b6d.tar.gz frameworks_base-d55da5d452fa20c7c4c4172884e0983bbeb79b6d.tar.bz2 |
stagefright aacenc: Use ARMv6 SSAT instruction
Change-Id: I652eaaa54e7766d9dca80fd8cc156ca481359471
Diffstat (limited to 'media/libstagefright/codecs')
-rw-r--r-- | media/libstagefright/codecs/aacenc/Android.mk | 2 | ||||
-rw-r--r-- | media/libstagefright/codecs/aacenc/basic_op/basic_op.h | 34 | ||||
-rw-r--r-- | media/libstagefright/codecs/aacenc/basic_op/typedefs.h | 7 |
3 files changed, 40 insertions, 3 deletions
diff --git a/media/libstagefright/codecs/aacenc/Android.mk b/media/libstagefright/codecs/aacenc/Android.mk index 8318ba4..c2579c7 100644 --- a/media/libstagefright/codecs/aacenc/Android.mk +++ b/media/libstagefright/codecs/aacenc/Android.mk @@ -79,7 +79,7 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV5E endif ifeq ($(VOTT), v7) -LOCAL_CFLAGS += -DARMV5E -DARMV7Neon -DARM_INASM -DARMV5_INASM +LOCAL_CFLAGS += -DARMV5E -DARMV7Neon -DARM_INASM -DARMV5_INASM -DARMV6_INASM LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV5E LOCAL_C_INCLUDES += $(LOCAL_PATH)/src/asm/ARMV7 endif diff --git a/media/libstagefright/codecs/aacenc/basic_op/basic_op.h b/media/libstagefright/codecs/aacenc/basic_op/basic_op.h index e878bba..7c45132 100644 --- a/media/libstagefright/codecs/aacenc/basic_op/basic_op.h +++ b/media/libstagefright/codecs/aacenc/basic_op/basic_op.h @@ -264,6 +264,18 @@ __inline Word32 ASM_shr(Word32 L_var1, Word16 var2) __inline Word32 ASM_shl(Word32 L_var1, Word16 var2) { +#if ARMV6_SAT + Word32 result; + asm ( + "CMP %[var2], #16\n" + "MOVLT %[result], %[L_var1], ASL %[var2]\n" + "MOVGE %[result], %[L_var1], ASL #16\n" + "SSAT %[result], #16, %[result]\n" + :[result]"=r"(result) + :[L_var1]"r"(L_var1), [var2]"r"(var2) + ); + return result; +#else Word32 result; Word32 tmp; asm ( @@ -277,6 +289,7 @@ __inline Word32 ASM_shl(Word32 L_var1, Word16 var2) :[L_var1]"r"(L_var1), [var2]"r"(var2), [mask]"r"(0x7fff) ); return result; +#endif } #endif @@ -288,7 +301,15 @@ __inline Word32 ASM_shl(Word32 L_var1, Word16 var2) #if (SATRUATE_IS_INLINE) __inline Word16 saturate(Word32 L_var1) { -#if ARMV5TE_SAT +#if ARMV6_SAT + Word16 result; + asm ( + "SSAT %[result], #16, %[L_var1]" + : [result]"=r"(result) + : [L_var1]"r"(L_var1) + ); + return result; +#elif ARMV5TE_SAT Word16 result; Word32 tmp; asm volatile ( @@ -671,7 +692,16 @@ __inline Word16 div_s (Word16 var1, Word16 var2) #if (MULT_IS_INLINE) __inline Word16 mult (Word16 var1, Word16 var2) { -#if ARMV5TE_MULT +#if ARMV5TE_MULT && ARMV6_SAT + Word32 result; + asm ( + "SMULBB %[result], %[var1], %[var2] \n" + "SSAT %[result], #16, %[result], ASR #15 \n" + :[result]"=r"(result) + :[var1]"r"(var1), [var2]"r"(var2) + ); + return result; +#elif ARMV5TE_MULT Word32 result, tmp; asm ( "SMULBB %[tmp], %[var1], %[var2] \n" diff --git a/media/libstagefright/codecs/aacenc/basic_op/typedefs.h b/media/libstagefright/codecs/aacenc/basic_op/typedefs.h index c924e2c..eb0d237 100644 --- a/media/libstagefright/codecs/aacenc/basic_op/typedefs.h +++ b/media/libstagefright/codecs/aacenc/basic_op/typedefs.h @@ -130,6 +130,13 @@ typedef unsigned __int64 UWord64; #define ARMV5TE_NORM_L 1 #define ARMV5TE_L_MPY_LS 1 #endif +#if ARMV6_INASM + #undef ARMV5TE_ADD + #define ARMV5TE_ADD 0 + #undef ARMV5TE_SUB + #define ARMV5TE_SUB 0 + #define ARMV6_SAT 1 +#endif //basic operation functions optimization flags #define SATRUATE_IS_INLINE 1 //define saturate as inline function |