summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libspeex/SOURCES9
-rw-r--r--apps/codecs/libspeex/os_support.h160
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
6exc_5_256_table.c 6exc_5_256_table.c
7exc_5_64_table.c 7exc_5_64_table.c
8exc_8_128_table.c 8exc_8_128_table.c
9fftwrap.c
10filterbank.c
11filters.c 9filters.c
12gain_table.c 10gain_table.c
13gain_table_lbr.c 11gain_table_lbr.c
14hexc_10_32_table.c 12hexc_10_32_table.c
15hexc_table.c 13hexc_table.c
16high_lsp_tables.c 14high_lsp_tables.c
17jitter.c
18kiss_fft.c
19kiss_fftr.c
20lbr_48k_tables.c 15lbr_48k_tables.c
21lpc.c 16lpc.c
22lsp.c 17lsp.c
23lsp_tables_nb.c 18lsp_tables_nb.c
24ltp.c 19ltp.c
25mdf.c
26modes.c 20modes.c
27modes_wb.c 21modes_wb.c
28nb_celp.c 22nb_celp.c
29oggframing.c 23oggframing.c
30preprocess.c
31quant_lsp.c 24quant_lsp.c
32rockbox.c 25rockbox.c
33sb_celp.c 26sb_celp.c
34smallft.c
35speex.c 27speex.c
36speex_callbacks.c 28speex_callbacks.c
37speex_header.c 29speex_header.c
38stereo.c 30stereo.c
39vbr.c 31vbr.c
40vorbis_psy.c
41vq.c 32vq.c
42window.c 33window.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
46static 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
54static 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
62static 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
70static 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
78static 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
86static 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
94static 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
102static 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
110static 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
119static 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
128static 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 */
138static 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
149static 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