diff options
Diffstat (limited to 'apps/codecs/libspeex')
-rw-r--r-- | apps/codecs/libspeex/SOURCES | 9 | ||||
-rw-r--r-- | apps/codecs/libspeex/os_support.h | 160 |
2 files changed, 160 insertions, 9 deletions
diff --git a/apps/codecs/libspeex/SOURCES b/apps/codecs/libspeex/SOURCES index 73c8c8bff7..f5a6786fa1 100644 --- a/apps/codecs/libspeex/SOURCES +++ b/apps/codecs/libspeex/SOURCES | |||
@@ -6,38 +6,29 @@ exc_20_32_table.c | |||
6 | exc_5_256_table.c | 6 | exc_5_256_table.c |
7 | exc_5_64_table.c | 7 | exc_5_64_table.c |
8 | exc_8_128_table.c | 8 | exc_8_128_table.c |
9 | fftwrap.c | ||
10 | filterbank.c | ||
11 | filters.c | 9 | filters.c |
12 | gain_table.c | 10 | gain_table.c |
13 | gain_table_lbr.c | 11 | gain_table_lbr.c |
14 | hexc_10_32_table.c | 12 | hexc_10_32_table.c |
15 | hexc_table.c | 13 | hexc_table.c |
16 | high_lsp_tables.c | 14 | high_lsp_tables.c |
17 | jitter.c | ||
18 | kiss_fft.c | ||
19 | kiss_fftr.c | ||
20 | lbr_48k_tables.c | 15 | lbr_48k_tables.c |
21 | lpc.c | 16 | lpc.c |
22 | lsp.c | 17 | lsp.c |
23 | lsp_tables_nb.c | 18 | lsp_tables_nb.c |
24 | ltp.c | 19 | ltp.c |
25 | mdf.c | ||
26 | modes.c | 20 | modes.c |
27 | modes_wb.c | 21 | modes_wb.c |
28 | nb_celp.c | 22 | nb_celp.c |
29 | oggframing.c | 23 | oggframing.c |
30 | preprocess.c | ||
31 | quant_lsp.c | 24 | quant_lsp.c |
32 | rockbox.c | 25 | rockbox.c |
33 | sb_celp.c | 26 | sb_celp.c |
34 | smallft.c | ||
35 | speex.c | 27 | speex.c |
36 | speex_callbacks.c | 28 | speex_callbacks.c |
37 | speex_header.c | 29 | speex_header.c |
38 | stereo.c | 30 | stereo.c |
39 | vbr.c | 31 | vbr.c |
40 | vorbis_psy.c | ||
41 | vq.c | 32 | vq.c |
42 | window.c | 33 | window.c |
43 | #ifdef CPU_COLDFIRE | 34 | #ifdef CPU_COLDFIRE |
diff --git a/apps/codecs/libspeex/os_support.h b/apps/codecs/libspeex/os_support.h new file mode 100644 index 0000000000..92262f1942 --- /dev/null +++ b/apps/codecs/libspeex/os_support.h | |||
@@ -0,0 +1,160 @@ | |||
1 | /* Copyright (C) 2007 Jean-Marc Valin | ||
2 | |||
3 | File: os_support.h | ||
4 | This is the (tiny) OS abstraction layer. Aside from math.h, this is the | ||
5 | only place where system headers are allowed. | ||
6 | |||
7 | Redistribution and use in source and binary forms, with or without | ||
8 | modification, are permitted provided that the following conditions are | ||
9 | met: | ||
10 | |||
11 | 1. Redistributions of source code must retain the above copyright notice, | ||
12 | this list of conditions and the following disclaimer. | ||
13 | |||
14 | 2. Redistributions in binary form must reproduce the above copyright | ||
15 | notice, this list of conditions and the following disclaimer in the | ||
16 | documentation and/or other materials provided with the distribution. | ||
17 | |||
18 | 3. The name of the author may not be used to endorse or promote products | ||
19 | derived from this software without specific prior written permission. | ||
20 | |||
21 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
22 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
23 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
24 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | ||
25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
30 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
31 | POSSIBILITY OF SUCH DAMAGE. | ||
32 | */ | ||
33 | |||
34 | #ifndef OS_SUPPORT_H | ||
35 | #define OS_SUPPORT_H | ||
36 | |||
37 | #include "config-speex.h" | ||
38 | #include "rockbox.h" | ||
39 | |||
40 | #include <string.h> | ||
41 | #include <stdio.h> | ||
42 | #include <stdlib.h> | ||
43 | |||
44 | /** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free */ | ||
45 | #ifndef OVERRIDE_SPEEX_ALLOC | ||
46 | static inline void *speex_alloc (int size) | ||
47 | { | ||
48 | return calloc(size,1); | ||
49 | } | ||
50 | #endif | ||
51 | |||
52 | /** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */ | ||
53 | #ifndef OVERRIDE_SPEEX_ALLOC_SCRATCH | ||
54 | static inline void *speex_alloc_scratch (int size) | ||
55 | { | ||
56 | return calloc(size,1); | ||
57 | } | ||
58 | #endif | ||
59 | |||
60 | /** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */ | ||
61 | #ifndef OVERRIDE_SPEEX_REALLOC | ||
62 | static inline void *speex_realloc (void *ptr, int size) | ||
63 | { | ||
64 | return realloc(ptr, size); | ||
65 | } | ||
66 | #endif | ||
67 | |||
68 | /** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */ | ||
69 | #ifndef OVERRIDE_SPEEX_FREE | ||
70 | static inline void speex_free (void *ptr) | ||
71 | { | ||
72 | free(ptr); | ||
73 | } | ||
74 | #endif | ||
75 | |||
76 | /** Same as speex_free, except that the area is only needed inside a Speex call (might cause problem with wideband though) */ | ||
77 | #ifndef OVERRIDE_SPEEX_FREE_SCRATCH | ||
78 | static inline void speex_free_scratch (void *ptr) | ||
79 | { | ||
80 | free(ptr); | ||
81 | } | ||
82 | #endif | ||
83 | |||
84 | /** Print warning message with integer argument to stderr */ | ||
85 | #ifndef OVERRIDE_SPEEX_MOVE | ||
86 | static inline void *speex_move (void *dest, void *src, int n) | ||
87 | { | ||
88 | return memmove(dest,src,n); | ||
89 | } | ||
90 | #endif | ||
91 | |||
92 | /** Print warning message with integer argument to stderr */ | ||
93 | #ifndef OVERRIDE_SPEEX_MOVE | ||
94 | static inline void *speex_memset (void *s, int c, int n) | ||
95 | { | ||
96 | return memset(s,c,n); | ||
97 | } | ||
98 | #endif | ||
99 | |||
100 | |||
101 | #ifndef OVERRIDE_SPEEX_FATAL | ||
102 | static inline void _speex_fatal(const char *str, const char *file, int line) | ||
103 | { | ||
104 | fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str); | ||
105 | exit(1); | ||
106 | } | ||
107 | #endif | ||
108 | |||
109 | #ifndef OVERRIDE_SPEEX_WARNING | ||
110 | static inline void speex_warning(const char *str) | ||
111 | { | ||
112 | #ifndef DISABLE_WARNINGS | ||
113 | fprintf (stderr, "warning: %s\n", str); | ||
114 | #endif | ||
115 | } | ||
116 | #endif | ||
117 | |||
118 | #ifndef OVERRIDE_SPEEX_WARNING_INT | ||
119 | static inline void speex_warning_int(const char *str, int val) | ||
120 | { | ||
121 | #ifndef DISABLE_WARNINGS | ||
122 | fprintf (stderr, "warning: %s %d\n", str, val); | ||
123 | #endif | ||
124 | } | ||
125 | #endif | ||
126 | |||
127 | #ifndef OVERRIDE_SPEEX_NOTIFY | ||
128 | static inline void speex_notify(const char *str) | ||
129 | { | ||
130 | #ifndef DISABLE_NOTIFICATIONS | ||
131 | fprintf (stderr, "notification: %s\n", str); | ||
132 | #endif | ||
133 | } | ||
134 | #endif | ||
135 | |||
136 | #ifndef OVERRIDE_SPEEX_PUTC | ||
137 | /** Speex wrapper for putc */ | ||
138 | static inline void _speex_putc(int ch, void *file) | ||
139 | { | ||
140 | FILE *f = (FILE *)file; | ||
141 | fprintf(f, "%c", ch); | ||
142 | } | ||
143 | #endif | ||
144 | |||
145 | #define speex_fatal(str) _speex_fatal(str, __FILE__, __LINE__); | ||
146 | #define speex_assert(cond) {if (!(cond)) {speex_fatal("assertion failed: " #cond);}} | ||
147 | |||
148 | #ifndef RELEASE | ||
149 | static inline void print_vec(float *vec, int len, char *name) | ||
150 | { | ||
151 | int i; | ||
152 | printf ("%s ", name); | ||
153 | for (i=0;i<len;i++) | ||
154 | printf (" %f", vec[i]); | ||
155 | printf ("\n"); | ||
156 | } | ||
157 | #endif | ||
158 | |||
159 | #endif | ||
160 | |||