diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2014-01-23 04:22:05 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2014-01-23 04:22:05 +0400 |
commit | 2e6876c07a2771462eff862bc6fcc423f2cd95af (patch) | |
tree | 7b3405e2dc42a7d25ca0bd694a0efcfb4cc2ce89 | |
parent | 9b3a3ad7ff3db7f43640be02faa0f869ecff5b99 (diff) |
Using SSAT in SIG2WORD16() on ARMv6
-rw-r--r-- | celt/arch.h | 2 | ||||
-rw-r--r-- | celt/arm/fixed_armv5e.h | 18 | ||||
-rw-r--r-- | celt/celt_decoder.c | 11 | ||||
-rw-r--r-- | celt/fixed_generic.h | 9 |
4 files changed, 29 insertions, 11 deletions
diff --git a/celt/arch.h b/celt/arch.h index c910c807..9f74ddd2 100644 --- a/celt/arch.h +++ b/celt/arch.h @@ -226,6 +226,8 @@ static OPUS_INLINE int celt_isnan(float x) #define SCALEIN(a) ((a)*CELT_SIG_SCALE) #define SCALEOUT(a) ((a)*(1/CELT_SIG_SCALE)) +#define SIG2WORD16(x) (x) + #endif /* !FIXED_POINT */ #ifndef GLOBAL_STACK_SIZE diff --git a/celt/arm/fixed_armv5e.h b/celt/arm/fixed_armv5e.h index 36d6bed0..36a63211 100644 --- a/celt/arm/fixed_armv5e.h +++ b/celt/arm/fixed_armv5e.h @@ -130,4 +130,22 @@ static OPUS_INLINE opus_val32 MULT16_16_armv5e(opus_val16 a, opus_val16 b) } #define MULT16_16(a, b) (MULT16_16_armv5e(a, b)) +#ifdef OPUS_ARM_INLINE_MEDIA + +#undef SIG2WORD16 +static OPUS_INLINE opus_val16 SIG2WORD16_armv6(opus_val32 x) +{ + celt_sig res; + __asm__( + "#SIG2WORD16\n\t" + "ssat %0, #16, %1, ASR #12\n\t" + : "=r"(res) + : "r"(x+2048) + ); + return EXTRACT16(res); +} +#define SIG2WORD16(x) (SIG2WORD16_armv6(x)) + +#endif /* OPUS_ARM_INLINE_MEDIA */ + #endif diff --git a/celt/celt_decoder.c b/celt/celt_decoder.c index 1e41ec11..8af96b79 100644 --- a/celt/celt_decoder.c +++ b/celt/celt_decoder.c @@ -178,17 +178,6 @@ void opus_custom_decoder_destroy(CELTDecoder *st) } #endif /* CUSTOM_MODES */ -static OPUS_INLINE opus_val16 SIG2WORD16(celt_sig x) -{ -#ifdef FIXED_POINT - x = PSHR32(x, SIG_SHIFT); - x = MAX32(x, -32768); - x = MIN32(x, 32767); - return EXTRACT16(x); -#else - return (opus_val16)x; -#endif -} #ifndef RESYNTH static diff --git a/celt/fixed_generic.h b/celt/fixed_generic.h index 8d13fde7..5ea1c7ba 100644 --- a/celt/fixed_generic.h +++ b/celt/fixed_generic.h @@ -135,4 +135,13 @@ /** Divide a 32-bit value by a 32-bit value. Result fits in 32 bits */ #define DIV32(a,b) (((opus_val32)(a))/((opus_val32)(b))) +static OPUS_INLINE opus_val16 SIG2WORD16_generic(celt_sig x) +{ + x = PSHR32(x, SIG_SHIFT); + x = MAX32(x, -32768); + x = MIN32(x, 32767); + return EXTRACT16(x); +} +#define SIG2WORD16(x) (SIG2WORD16_generic(x)) + #endif |