diff options
author | William Wilgus <me.theuser@yahoo.com> | 2019-01-04 02:01:18 -0600 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-04-23 14:23:04 +0000 |
commit | 14c6bb798d6bebc80f07e863236adbaf8d156a9c (patch) | |
tree | 551a4b641906c2626af844fa3239c1b2b1ff0ad3 /lib/rbcodec/codecs/libopus/silk/macros.h | |
parent | 75d93937965ec4df70d37df6d4feea04577c996b (diff) | |
download | rockbox-14c6bb798d6bebc80f07e863236adbaf8d156a9c.tar.gz rockbox-14c6bb798d6bebc80f07e863236adbaf8d156a9c.zip |
Sync opus codec to upstream git
Change-Id: I0cfcc0005c4ad7bfbb1aaf454188ce70fb043dc1
Diffstat (limited to 'lib/rbcodec/codecs/libopus/silk/macros.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/silk/macros.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/rbcodec/codecs/libopus/silk/macros.h b/lib/rbcodec/codecs/libopus/silk/macros.h index 05623b5df8..3c67b6e5d9 100644 --- a/lib/rbcodec/codecs/libopus/silk/macros.h +++ b/lib/rbcodec/codecs/libopus/silk/macros.h | |||
@@ -34,20 +34,37 @@ POSSIBILITY OF SUCH DAMAGE. | |||
34 | 34 | ||
35 | #include "opus_types.h" | 35 | #include "opus_types.h" |
36 | #include "opus_defines.h" | 36 | #include "opus_defines.h" |
37 | #include "arch.h" | ||
37 | 38 | ||
38 | /* This is an OPUS_INLINE header file for general platform. */ | 39 | /* This is an OPUS_INLINE header file for general platform. */ |
39 | 40 | ||
40 | /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ | 41 | /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ |
42 | #if OPUS_FAST_INT64 | ||
43 | #define silk_SMULWB(a32, b32) ((opus_int32)(((a32) * (opus_int64)((opus_int16)(b32))) >> 16)) | ||
44 | #else | ||
41 | #define silk_SMULWB(a32, b32) ((((a32) >> 16) * (opus_int32)((opus_int16)(b32))) + ((((a32) & 0x0000FFFF) * (opus_int32)((opus_int16)(b32))) >> 16)) | 45 | #define silk_SMULWB(a32, b32) ((((a32) >> 16) * (opus_int32)((opus_int16)(b32))) + ((((a32) & 0x0000FFFF) * (opus_int32)((opus_int16)(b32))) >> 16)) |
46 | #endif | ||
42 | 47 | ||
43 | /* a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int */ | 48 | /* a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int */ |
49 | #if OPUS_FAST_INT64 | ||
50 | #define silk_SMLAWB(a32, b32, c32) ((opus_int32)((a32) + (((b32) * (opus_int64)((opus_int16)(c32))) >> 16))) | ||
51 | #else | ||
44 | #define silk_SMLAWB(a32, b32, c32) ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16))) | 52 | #define silk_SMLAWB(a32, b32, c32) ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16))) |
53 | #endif | ||
45 | 54 | ||
46 | /* (a32 * (b32 >> 16)) >> 16 */ | 55 | /* (a32 * (b32 >> 16)) >> 16 */ |
56 | #if OPUS_FAST_INT64 | ||
57 | #define silk_SMULWT(a32, b32) ((opus_int32)(((a32) * (opus_int64)((b32) >> 16)) >> 16)) | ||
58 | #else | ||
47 | #define silk_SMULWT(a32, b32) (((a32) >> 16) * ((b32) >> 16) + ((((a32) & 0x0000FFFF) * ((b32) >> 16)) >> 16)) | 59 | #define silk_SMULWT(a32, b32) (((a32) >> 16) * ((b32) >> 16) + ((((a32) & 0x0000FFFF) * ((b32) >> 16)) >> 16)) |
60 | #endif | ||
48 | 61 | ||
49 | /* a32 + (b32 * (c32 >> 16)) >> 16 */ | 62 | /* a32 + (b32 * (c32 >> 16)) >> 16 */ |
63 | #if OPUS_FAST_INT64 | ||
64 | #define silk_SMLAWT(a32, b32, c32) ((opus_int32)((a32) + (((b32) * ((opus_int64)(c32) >> 16)) >> 16))) | ||
65 | #else | ||
50 | #define silk_SMLAWT(a32, b32, c32) ((a32) + (((b32) >> 16) * ((c32) >> 16)) + ((((b32) & 0x0000FFFF) * ((c32) >> 16)) >> 16)) | 66 | #define silk_SMLAWT(a32, b32, c32) ((a32) + (((b32) >> 16) * ((c32) >> 16)) + ((((b32) & 0x0000FFFF) * ((c32) >> 16)) >> 16)) |
67 | #endif | ||
51 | 68 | ||
52 | /* (opus_int32)((opus_int16)(a3))) * (opus_int32)((opus_int16)(b32)) output have to be 32bit int */ | 69 | /* (opus_int32)((opus_int16)(a3))) * (opus_int32)((opus_int16)(b32)) output have to be 32bit int */ |
53 | #define silk_SMULBB(a32, b32) ((opus_int32)((opus_int16)(a32)) * (opus_int32)((opus_int16)(b32))) | 70 | #define silk_SMULBB(a32, b32) ((opus_int32)((opus_int16)(a32)) * (opus_int32)((opus_int16)(b32))) |
@@ -65,10 +82,18 @@ POSSIBILITY OF SUCH DAMAGE. | |||
65 | #define silk_SMLAL(a64, b32, c32) (silk_ADD64((a64), ((opus_int64)(b32) * (opus_int64)(c32)))) | 82 | #define silk_SMLAL(a64, b32, c32) (silk_ADD64((a64), ((opus_int64)(b32) * (opus_int64)(c32)))) |
66 | 83 | ||
67 | /* (a32 * b32) >> 16 */ | 84 | /* (a32 * b32) >> 16 */ |
85 | #if OPUS_FAST_INT64 | ||
86 | #define silk_SMULWW(a32, b32) ((opus_int32)(((opus_int64)(a32) * (b32)) >> 16)) | ||
87 | #else | ||
68 | #define silk_SMULWW(a32, b32) silk_MLA(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)) | 88 | #define silk_SMULWW(a32, b32) silk_MLA(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16)) |
89 | #endif | ||
69 | 90 | ||
70 | /* a32 + ((b32 * c32) >> 16) */ | 91 | /* a32 + ((b32 * c32) >> 16) */ |
92 | #if OPUS_FAST_INT64 | ||
93 | #define silk_SMLAWW(a32, b32, c32) ((opus_int32)((a32) + (((opus_int64)(b32) * (c32)) >> 16))) | ||
94 | #else | ||
71 | #define silk_SMLAWW(a32, b32, c32) silk_MLA(silk_SMLAWB((a32), (b32), (c32)), (b32), silk_RSHIFT_ROUND((c32), 16)) | 95 | #define silk_SMLAWW(a32, b32, c32) silk_MLA(silk_SMLAWB((a32), (b32), (c32)), (b32), silk_RSHIFT_ROUND((c32), 16)) |
96 | #endif | ||
72 | 97 | ||
73 | /* add/subtract with output saturated */ | 98 | /* add/subtract with output saturated */ |
74 | #define silk_ADD_SAT32(a, b) ((((opus_uint32)(a) + (opus_uint32)(b)) & 0x80000000) == 0 ? \ | 99 | #define silk_ADD_SAT32(a, b) ((((opus_uint32)(a) + (opus_uint32)(b)) & 0x80000000) == 0 ? \ |
@@ -118,8 +143,8 @@ static OPUS_INLINE opus_int32 silk_CLZ32(opus_int32 in32) | |||
118 | #include "arm/macros_armv5e.h" | 143 | #include "arm/macros_armv5e.h" |
119 | #endif | 144 | #endif |
120 | 145 | ||
121 | #ifdef OPUS_CF_INLINE_ASM | 146 | #ifdef OPUS_ARM_PRESUME_AARCH64_NEON_INTR |
122 | #include "cf/macros_cf.h" | 147 | #include "arm/macros_arm64.h" |
123 | #endif | 148 | #endif |
124 | 149 | ||
125 | #endif /* SILK_MACROS_H */ | 150 | #endif /* SILK_MACROS_H */ |