summaryrefslogtreecommitdiff
path: root/apps/codecs/libspeex/misc.h
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-10-26 01:16:55 +0000
committerThom Johansen <thomj@rockbox.org>2007-10-26 01:16:55 +0000
commitfa971b142d794c9620b823d6b9d1937397c1f1e1 (patch)
tree55565a0765c15be5d1df4cfb1c04dc92de50fe5d /apps/codecs/libspeex/misc.h
parent14da611cd32d084813bb0d2e2318b81c3ea2953a (diff)
downloadrockbox-fa971b142d794c9620b823d6b9d1937397c1f1e1.tar.gz
rockbox-fa971b142d794c9620b823d6b9d1937397c1f1e1.zip
Sync with Speex SVN. Syntactic change in filters_cf.S.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15310 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libspeex/misc.h')
-rw-r--r--apps/codecs/libspeex/misc.h133
1 files changed, 2 insertions, 131 deletions
diff --git a/apps/codecs/libspeex/misc.h b/apps/codecs/libspeex/misc.h
index 8702919b7b..7dcc4f25f9 100644
--- a/apps/codecs/libspeex/misc.h
+++ b/apps/codecs/libspeex/misc.h
@@ -40,9 +40,9 @@
40#ifndef SPEEX_VERSION 40#ifndef SPEEX_VERSION
41#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */ 41#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */
42#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */ 42#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */
43#define SPEEX_MICRO_VERSION 14 /**< Micro Speex version. */ 43#define SPEEX_MICRO_VERSION 15 /**< Micro Speex version. */
44#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */ 44#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */
45#define SPEEX_VERSION "speex-1.2beta2" /**< Speex version string. */ 45#define SPEEX_VERSION "speex-1.2beta3" /**< Speex version string. */
46#endif 46#endif
47 47
48/* A couple test to catch stupid option combinations */ 48/* A couple test to catch stupid option combinations */
@@ -71,7 +71,6 @@
71#endif 71#endif
72 72
73#include "arch.h" 73#include "arch.h"
74#include "rockbox.h"
75 74
76/** Convert little endian */ 75/** Convert little endian */
77static inline spx_int32_t le_int(spx_int32_t i) 76static inline spx_int32_t le_int(spx_int32_t i)
@@ -91,138 +90,10 @@ static inline spx_int32_t le_int(spx_int32_t i)
91#endif 90#endif
92} 91}
93 92
94#define speex_fatal(str) _speex_fatal(str, __FILE__, __LINE__);
95#define speex_assert(cond) {if (!(cond)) {speex_fatal("assertion failed: " #cond);}}
96
97#ifndef RELEASE
98static void print_vec(float *vec, int len, char *name)
99{
100 int i;
101 printf ("%s ", name);
102 for (i=0;i<len;i++)
103 printf (" %f", vec[i]);
104 printf ("\n");
105}
106#endif
107 93
108#ifdef FIXED_DEBUG 94#ifdef FIXED_DEBUG
109long long spx_mips=0; 95long long spx_mips=0;
110#endif 96#endif
111 97
112 98
113/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free */
114#ifndef OVERRIDE_SPEEX_ALLOC
115static inline void *speex_alloc (int size)
116{
117 return calloc(size,1);
118}
119#endif
120
121/** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
122#ifndef OVERRIDE_SPEEX_ALLOC_SCRATCH
123static inline void *speex_alloc_scratch (int size)
124{
125 return calloc(size,1);
126}
127#endif
128
129/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
130#ifndef OVERRIDE_SPEEX_REALLOC
131static inline void *speex_realloc (void *ptr, int size)
132{
133 return realloc(ptr, size);
134}
135#endif
136
137/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
138#ifndef OVERRIDE_SPEEX_FREE
139static inline void speex_free (void *ptr)
140{
141 free(ptr);
142}
143#endif
144
145/** Same as speex_free, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
146#ifndef OVERRIDE_SPEEX_FREE_SCRATCH
147static inline void speex_free_scratch (void *ptr)
148{
149 free(ptr);
150}
151#endif
152
153/** Print warning message with integer argument to stderr */
154#ifndef OVERRIDE_SPEEX_MOVE
155static inline void *speex_move (void *dest, void *src, int n)
156{
157 return memmove(dest,src,n);
158}
159#endif
160
161#ifndef OVERRIDE_SPEEX_FATAL
162static inline void _speex_fatal(const char *str, const char *file, int line)
163{
164 fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str);
165 exit(1);
166}
167#endif
168
169#ifndef OVERRIDE_SPEEX_WARNING
170static inline void speex_warning(const char *str)
171{
172#ifndef DISABLE_WARNINGS
173 fprintf (stderr, "warning: %s\n", str);
174#endif
175}
176#endif
177
178#ifndef OVERRIDE_SPEEX_WARNING_INT
179static inline void speex_warning_int(const char *str, int val)
180{
181#ifndef DISABLE_WARNINGS
182 fprintf (stderr, "warning: %s %d\n", str, val);
183#endif
184}
185#endif
186
187#ifndef OVERRIDE_SPEEX_NOTIFY
188static inline void speex_notify(const char *str)
189{
190#ifndef DISABLE_NOTIFICATIONS
191 fprintf (stderr, "notification: %s\n", str);
192#endif
193}
194#endif
195
196#ifdef FIXED_POINT
197/** Generate a pseudo-random number */
198static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
199{
200 spx_word32_t res;
201 *seed = 1664525 * *seed + 1013904223;
202 res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
203 return EXTRACT16(PSHR32(SUB32(res, SHR32(res, 3)),14));
204}
205#else
206/** Generate a pseudo-random number */
207static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
208{
209 const unsigned int jflone = 0x3f800000;
210 const unsigned int jflmsk = 0x007fffff;
211 union {int i; float f;} ran;
212 *seed = 1664525 * *seed + 1013904223;
213 ran.i = jflone | (jflmsk & *seed);
214 ran.f -= 1.5;
215 return 3.4642*std*ran.f;
216}
217#endif
218
219#ifndef OVERRIDE_SPEEX_PUTC
220/** Speex wrapper for putc */
221static inline void _speex_putc(int ch, void *file)
222{
223 FILE *f = (FILE *)file;
224 fprintf(f, "%c", ch);
225}
226#endif
227
228#endif 99#endif