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/opus_custom.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/opus_custom.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/opus_custom.h | 88 |
1 files changed, 48 insertions, 40 deletions
diff --git a/lib/rbcodec/codecs/libopus/opus_custom.h b/lib/rbcodec/codecs/libopus/opus_custom.h index f8124009a2..6cf3963076 100644 --- a/lib/rbcodec/codecs/libopus/opus_custom.h +++ b/lib/rbcodec/codecs/libopus/opus_custom.h | |||
@@ -42,15 +42,15 @@ extern "C" { | |||
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #ifdef CUSTOM_MODES | 44 | #ifdef CUSTOM_MODES |
45 | #define OPUS_CUSTOM_EXPORT OPUS_EXPORT | 45 | # define OPUS_CUSTOM_EXPORT OPUS_EXPORT |
46 | #define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT | 46 | # define OPUS_CUSTOM_EXPORT_STATIC OPUS_EXPORT |
47 | #else | 47 | #else |
48 | #define OPUS_CUSTOM_EXPORT | 48 | # define OPUS_CUSTOM_EXPORT |
49 | #ifdef CELT_C | 49 | # ifdef OPUS_BUILD |
50 | #define OPUS_CUSTOM_EXPORT_STATIC static inline | 50 | # define OPUS_CUSTOM_EXPORT_STATIC static inline |
51 | #else | 51 | # else |
52 | #define OPUS_CUSTOM_EXPORT_STATIC | 52 | # define OPUS_CUSTOM_EXPORT_STATIC |
53 | #endif | 53 | # endif |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | /** @defgroup opus_custom Opus Custom | 56 | /** @defgroup opus_custom Opus Custom |
@@ -126,33 +126,19 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomMode *opus_custom_mode_crea | |||
126 | */ | 126 | */ |
127 | OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(OpusCustomMode *mode); | 127 | OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(OpusCustomMode *mode); |
128 | 128 | ||
129 | |||
130 | #if !defined(OPUS_BUILD) || defined(CELT_ENCODER_C) | ||
131 | |||
129 | /* Encoder */ | 132 | /* Encoder */ |
130 | /** Gets the size of an OpusCustomEncoder structure. | 133 | /** Gets the size of an OpusCustomEncoder structure. |
131 | * @param [in] mode <tt>OpusCustomMode *</tt>: Mode configuration | 134 | * @param [in] mode <tt>OpusCustomMode *</tt>: Mode configuration |
132 | * @param [in] channels <tt>int</tt>: Number of channels | 135 | * @param [in] channels <tt>int</tt>: Number of channels |
133 | * @returns size | 136 | * @returns size |
134 | */ | 137 | */ |
135 | # if 0 | ||
136 | OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_size( | 138 | OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_size( |
137 | const OpusCustomMode *mode, | 139 | const OpusCustomMode *mode, |
138 | int channels | 140 | int channels |
139 | ) OPUS_ARG_NONNULL(1); | 141 | ) OPUS_ARG_NONNULL(1); |
140 | #endif | ||
141 | |||
142 | /** Creates a new encoder state. Each stream needs its own encoder | ||
143 | * state (can't be shared across simultaneous streams). | ||
144 | * @param [in] mode <tt>OpusCustomMode*</tt>: Contains all the information about the characteristics of | ||
145 | * the stream (must be the same characteristics as used for the | ||
146 | * decoder) | ||
147 | * @param [in] channels <tt>int</tt>: Number of channels | ||
148 | * @param [out] error <tt>int*</tt>: Returns an error code | ||
149 | * @return Newly created encoder state. | ||
150 | */ | ||
151 | OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encoder_create( | ||
152 | const OpusCustomMode *mode, | ||
153 | int channels, | ||
154 | int *error | ||
155 | ) OPUS_ARG_NONNULL(1); | ||
156 | 142 | ||
157 | /** Initializes a previously allocated encoder state | 143 | /** Initializes a previously allocated encoder state |
158 | * The memory pointed to by st must be the size returned by opus_custom_encoder_get_size. | 144 | * The memory pointed to by st must be the size returned by opus_custom_encoder_get_size. |
@@ -166,14 +152,31 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encode | |||
166 | * @param [in] channels <tt>int</tt>: Number of channels | 152 | * @param [in] channels <tt>int</tt>: Number of channels |
167 | * @return OPUS_OK Success or @ref opus_errorcodes | 153 | * @return OPUS_OK Success or @ref opus_errorcodes |
168 | */ | 154 | */ |
169 | #if 0 | ||
170 | OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_init( | 155 | OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_init( |
171 | OpusCustomEncoder *st, | 156 | OpusCustomEncoder *st, |
172 | const OpusCustomMode *mode, | 157 | const OpusCustomMode *mode, |
173 | int channels | 158 | int channels |
174 | ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2); | 159 | ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2); |
160 | |||
175 | #endif | 161 | #endif |
176 | 162 | ||
163 | |||
164 | /** Creates a new encoder state. Each stream needs its own encoder | ||
165 | * state (can't be shared across simultaneous streams). | ||
166 | * @param [in] mode <tt>OpusCustomMode*</tt>: Contains all the information about the characteristics of | ||
167 | * the stream (must be the same characteristics as used for the | ||
168 | * decoder) | ||
169 | * @param [in] channels <tt>int</tt>: Number of channels | ||
170 | * @param [out] error <tt>int*</tt>: Returns an error code | ||
171 | * @return Newly created encoder state. | ||
172 | */ | ||
173 | OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encoder_create( | ||
174 | const OpusCustomMode *mode, | ||
175 | int channels, | ||
176 | int *error | ||
177 | ) OPUS_ARG_NONNULL(1); | ||
178 | |||
179 | |||
177 | /** Destroys a an encoder state. | 180 | /** Destroys a an encoder state. |
178 | * @param[in] st <tt>OpusCustomEncoder*</tt>: State to be freed. | 181 | * @param[in] st <tt>OpusCustomEncoder*</tt>: State to be freed. |
179 | */ | 182 | */ |
@@ -233,6 +236,8 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode( | |||
233 | */ | 236 | */ |
234 | OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1); | 237 | OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * OPUS_RESTRICT st, int request, ...) OPUS_ARG_NONNULL(1); |
235 | 238 | ||
239 | |||
240 | #if !defined(OPUS_BUILD) || defined(CELT_DECODER_C) | ||
236 | /* Decoder */ | 241 | /* Decoder */ |
237 | 242 | ||
238 | /** Gets the size of an OpusCustomDecoder structure. | 243 | /** Gets the size of an OpusCustomDecoder structure. |
@@ -245,20 +250,6 @@ OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_decoder_get_si | |||
245 | int channels | 250 | int channels |
246 | ) OPUS_ARG_NONNULL(1); | 251 | ) OPUS_ARG_NONNULL(1); |
247 | 252 | ||
248 | /** Creates a new decoder state. Each stream needs its own decoder state (can't | ||
249 | * be shared across simultaneous streams). | ||
250 | * @param [in] mode <tt>OpusCustomMode</tt>: Contains all the information about the characteristics of the | ||
251 | * stream (must be the same characteristics as used for the encoder) | ||
252 | * @param [in] channels <tt>int</tt>: Number of channels | ||
253 | * @param [out] error <tt>int*</tt>: Returns an error code | ||
254 | * @return Newly created decoder state. | ||
255 | */ | ||
256 | OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decoder_create( | ||
257 | const OpusCustomMode *mode, | ||
258 | int channels, | ||
259 | int *error | ||
260 | ) OPUS_ARG_NONNULL(1); | ||
261 | |||
262 | /** Initializes a previously allocated decoder state | 253 | /** Initializes a previously allocated decoder state |
263 | * The memory pointed to by st must be the size returned by opus_custom_decoder_get_size. | 254 | * The memory pointed to by st must be the size returned by opus_custom_decoder_get_size. |
264 | * This is intended for applications which use their own allocator instead of malloc. | 255 | * This is intended for applications which use their own allocator instead of malloc. |
@@ -277,6 +268,23 @@ OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_init( | |||
277 | int channels | 268 | int channels |
278 | ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2); | 269 | ) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2); |
279 | 270 | ||
271 | #endif | ||
272 | |||
273 | |||
274 | /** Creates a new decoder state. Each stream needs its own decoder state (can't | ||
275 | * be shared across simultaneous streams). | ||
276 | * @param [in] mode <tt>OpusCustomMode</tt>: Contains all the information about the characteristics of the | ||
277 | * stream (must be the same characteristics as used for the encoder) | ||
278 | * @param [in] channels <tt>int</tt>: Number of channels | ||
279 | * @param [out] error <tt>int*</tt>: Returns an error code | ||
280 | * @return Newly created decoder state. | ||
281 | */ | ||
282 | OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decoder_create( | ||
283 | const OpusCustomMode *mode, | ||
284 | int channels, | ||
285 | int *error | ||
286 | ) OPUS_ARG_NONNULL(1); | ||
287 | |||
280 | /** Destroys a an decoder state. | 288 | /** Destroys a an decoder state. |
281 | * @param[in] st <tt>OpusCustomDecoder*</tt>: State to be freed. | 289 | * @param[in] st <tt>OpusCustomDecoder*</tt>: State to be freed. |
282 | */ | 290 | */ |