diff options
author | Nils Wallménius <nils@rockbox.org> | 2013-05-20 22:25:57 +0200 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2013-08-31 08:30:51 +0200 |
commit | 580b307fd791c0997a8831bc800bba87797bfb7e (patch) | |
tree | 807846056f06fd944a750ce41217a877910ebd59 /lib/rbcodec/codecs/libopus/silk/macros.h | |
parent | 74761b70acd96cecc0d35450dd56a98ad9ee7d3d (diff) | |
download | rockbox-580b307fd791c0997a8831bc800bba87797bfb7e.tar.gz rockbox-580b307fd791c0997a8831bc800bba87797bfb7e.zip |
Sync opus codec to upstream git
Sync opus codec to upstream commit
02fed471a4568852d6618e041c4f2af0d7730ee2 (August 30 2013)
This brings in a lot of optimizations but also makes the diff
between our codec and the upstream much smaller as most of our
optimizations have been upstreamed or supeceded.
Speedups across the board for CELT mode files:
64kbps 128kbps
H300 9.82MHz 15.48MHz
c200 4.86MHz 9.63MHz
fuze v1 10.32MHz 15.92MHz
For the silk mode test file (16kbps) arm targets get a speedup
of about 2MHz while the H300 is 7.8MHz slower, likely because it's
now using the pseudostack more rather than the real stack which
is in iram. Patches to get around that are upcomming.
Change-Id: Ifecf963e461c51ac42e09dac1e91bc4bc3b12fa3
Diffstat (limited to 'lib/rbcodec/codecs/libopus/silk/macros.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/silk/macros.h | 63 |
1 files changed, 20 insertions, 43 deletions
diff --git a/lib/rbcodec/codecs/libopus/silk/macros.h b/lib/rbcodec/codecs/libopus/silk/macros.h index d84cd73522..8aba9bb85f 100644 --- a/lib/rbcodec/codecs/libopus/silk/macros.h +++ b/lib/rbcodec/codecs/libopus/silk/macros.h | |||
@@ -12,7 +12,7 @@ documentation and/or other materials provided with the distribution. | |||
12 | names of specific contributors, may be used to endorse or promote | 12 | names of specific contributors, may be used to endorse or promote |
13 | products derived from this software without specific prior written | 13 | products derived from this software without specific prior written |
14 | permission. | 14 | permission. |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
@@ -29,7 +29,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
29 | #define SILK_MACROS_H | 29 | #define SILK_MACROS_H |
30 | 30 | ||
31 | #ifdef HAVE_CONFIG_H | 31 | #ifdef HAVE_CONFIG_H |
32 | #include "opus_config.h" | 32 | #include "config.h" |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | /* This is an inline header file for general platform. */ | 35 | /* This is an inline header file for general platform. */ |
@@ -76,59 +76,36 @@ POSSIBILITY OF SUCH DAMAGE. | |||
76 | (( (a) & ((b)^0x80000000) & 0x80000000) ? silk_int32_MIN : (a)-(b)) : \ | 76 | (( (a) & ((b)^0x80000000) & 0x80000000) ? silk_int32_MIN : (a)-(b)) : \ |
77 | ((((a)^0x80000000) & (b) & 0x80000000) ? silk_int32_MAX : (a)-(b)) ) | 77 | ((((a)^0x80000000) & (b) & 0x80000000) ? silk_int32_MAX : (a)-(b)) ) |
78 | 78 | ||
79 | #include "ecintrin.h" | ||
80 | |||
79 | static inline opus_int32 silk_CLZ16(opus_int16 in16) | 81 | static inline opus_int32 silk_CLZ16(opus_int16 in16) |
80 | { | 82 | { |
81 | opus_int32 out32 = 0; | 83 | return 32 - EC_ILOG(in16<<16|0x8000); |
82 | if( in16 == 0 ) { | ||
83 | return 16; | ||
84 | } | ||
85 | /* test nibbles */ | ||
86 | if( in16 & 0xFF00 ) { | ||
87 | if( in16 & 0xF000 ) { | ||
88 | in16 >>= 12; | ||
89 | } else { | ||
90 | out32 += 4; | ||
91 | in16 >>= 8; | ||
92 | } | ||
93 | } else { | ||
94 | if( in16 & 0xFFF0 ) { | ||
95 | out32 += 8; | ||
96 | in16 >>= 4; | ||
97 | } else { | ||
98 | out32 += 12; | ||
99 | } | ||
100 | } | ||
101 | /* test bits and return */ | ||
102 | if( in16 & 0xC ) { | ||
103 | if( in16 & 0x8 ) | ||
104 | return out32 + 0; | ||
105 | else | ||
106 | return out32 + 1; | ||
107 | } else { | ||
108 | if( in16 & 0xE ) | ||
109 | return out32 + 2; | ||
110 | else | ||
111 | return out32 + 3; | ||
112 | } | ||
113 | } | 84 | } |
114 | 85 | ||
115 | static inline opus_int32 silk_CLZ32(opus_int32 in32) | 86 | static inline opus_int32 silk_CLZ32(opus_int32 in32) |
116 | { | 87 | { |
117 | /* test highest 16 bits and convert to opus_int16 */ | 88 | return in32 ? 32 - EC_ILOG(in32) : 32; |
118 | if( in32 & 0xFFFF0000 ) { | ||
119 | return silk_CLZ16((opus_int16)(in32 >> 16)); | ||
120 | } else { | ||
121 | return silk_CLZ16((opus_int16)in32) + 16; | ||
122 | } | ||
123 | } | 89 | } |
124 | 90 | ||
125 | /* Row based */ | 91 | /* Row based */ |
126 | #define matrix_ptr(Matrix_base_adr, row, column, N) *(Matrix_base_adr + ((row)*(N)+(column))) | 92 | #define matrix_ptr(Matrix_base_adr, row, column, N) \ |
127 | #define matrix_adr(Matrix_base_adr, row, column, N) (Matrix_base_adr + ((row)*(N)+(column))) | 93 | (*((Matrix_base_adr) + ((row)*(N)+(column)))) |
94 | #define matrix_adr(Matrix_base_adr, row, column, N) \ | ||
95 | ((Matrix_base_adr) + ((row)*(N)+(column))) | ||
128 | 96 | ||
129 | /* Column based */ | 97 | /* Column based */ |
130 | #ifndef matrix_c_ptr | 98 | #ifndef matrix_c_ptr |
131 | # define matrix_c_ptr(Matrix_base_adr, row, column, M) *(Matrix_base_adr + ((row)+(M)*(column))) | 99 | # define matrix_c_ptr(Matrix_base_adr, row, column, M) \ |
100 | (*((Matrix_base_adr) + ((row)+(M)*(column)))) | ||
101 | #endif | ||
102 | |||
103 | #ifdef ARMv4_ASM | ||
104 | #include "arm/macros_armv4.h" | ||
105 | #endif | ||
106 | |||
107 | #ifdef ARMv5E_ASM | ||
108 | #include "arm/macros_armv5e.h" | ||
132 | #endif | 109 | #endif |
133 | 110 | ||
134 | #endif /* SILK_MACROS_H */ | 111 | #endif /* SILK_MACROS_H */ |