summaryrefslogtreecommitdiff
path: root/apps/codecs
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/adx.c2
-rw-r--r--apps/codecs/demac/demac.c1
-rw-r--r--apps/codecs/demac/libdemac/parser.c2
-rw-r--r--apps/codecs/demac/wavwrite.c2
-rw-r--r--apps/codecs/lib/codeclib.h10
-rw-r--r--apps/codecs/lib/tlsf/src/tlsf.c2
-rw-r--r--apps/codecs/lib/tlsf/src/tlsf.h2
-rw-r--r--apps/codecs/libatrac/main.c2
-rw-r--r--apps/codecs/libcook/main.c2
-rw-r--r--apps/codecs/libfaad/common.h2
-rw-r--r--apps/codecs/libmad/libmad.make2
-rw-r--r--apps/codecs/libpcm/adpcm_seek.h2
-rw-r--r--apps/codecs/libpcm/ima_adpcm_common.c16
-rw-r--r--apps/codecs/libpcm/ima_adpcm_common.h1
-rw-r--r--apps/codecs/libpcm/pcm_common.h2
-rw-r--r--apps/codecs/librm/rm.c2
-rw-r--r--apps/codecs/libtremor/config-tremor.h2
-rw-r--r--apps/codecs/libtremor/ctype.c4
-rw-r--r--apps/codecs/libwavpack/words.c6
19 files changed, 37 insertions, 27 deletions
diff --git a/apps/codecs/adx.c b/apps/codecs/adx.c
index fe32653b18..dd5bba16e7 100644
--- a/apps/codecs/adx.c
+++ b/apps/codecs/adx.c
@@ -18,6 +18,8 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21
22#include <limits.h>
21#include "codeclib.h" 23#include "codeclib.h"
22#include "inttypes.h" 24#include "inttypes.h"
23#include "math.h" 25#include "math.h"
diff --git a/apps/codecs/demac/demac.c b/apps/codecs/demac/demac.c
index 5e9893687d..3e97fff2c9 100644
--- a/apps/codecs/demac/demac.c
+++ b/apps/codecs/demac/demac.c
@@ -46,7 +46,6 @@ avoided by writing the decoded data one sample at a time.
46#include <stdio.h> 46#include <stdio.h>
47#include <inttypes.h> 47#include <inttypes.h>
48#include <stdlib.h> 48#include <stdlib.h>
49#include <sys/types.h>
50#include <sys/stat.h> 49#include <sys/stat.h>
51#include <fcntl.h> 50#include <fcntl.h>
52#include <unistd.h> 51#include <unistd.h>
diff --git a/apps/codecs/demac/libdemac/parser.c b/apps/codecs/demac/libdemac/parser.c
index ebde36deed..2af4a292b8 100644
--- a/apps/codecs/demac/libdemac/parser.c
+++ b/apps/codecs/demac/libdemac/parser.c
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
27#ifndef ROCKBOX 27#ifndef ROCKBOX
28#include <stdio.h> 28#include <stdio.h>
29#include <stdlib.h> 29#include <stdlib.h>
30#include <sys/types.h> 30#include "inttypes.h"
31#include <sys/stat.h> 31#include <sys/stat.h>
32#include <fcntl.h> 32#include <fcntl.h>
33#include <unistd.h> 33#include <unistd.h>
diff --git a/apps/codecs/demac/wavwrite.c b/apps/codecs/demac/wavwrite.c
index 72c7950dd4..71d2b7bb97 100644
--- a/apps/codecs/demac/wavwrite.c
+++ b/apps/codecs/demac/wavwrite.c
@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
25#include <stdio.h> 25#include <stdio.h>
26#include <inttypes.h> 26#include <inttypes.h>
27#include <stdlib.h> 27#include <stdlib.h>
28#include <sys/types.h> 28#include "inttypes.h"
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <fcntl.h> 30#include <fcntl.h>
31#include <unistd.h> 31#include <unistd.h>
diff --git a/apps/codecs/lib/codeclib.h b/apps/codecs/lib/codeclib.h
index 817d86a6a3..b7685ebbcb 100644
--- a/apps/codecs/lib/codeclib.h
+++ b/apps/codecs/lib/codeclib.h
@@ -22,9 +22,10 @@
22#ifndef __CODECLIB_H__ 22#ifndef __CODECLIB_H__
23#define __CODECLIB_H__ 23#define __CODECLIB_H__
24 24
25#include <inttypes.h>
26#include <string.h>
25#include "config.h" 27#include "config.h"
26#include "codecs.h" 28#include "codecs.h"
27#include <sys/types.h>
28#include "mdct.h" 29#include "mdct.h"
29#include "fft.h" 30#include "fft.h"
30 31
@@ -44,6 +45,7 @@ extern unsigned char* filebuf; /* The rest of the MP3 buffer
44#define calloc(x,y) codec_calloc(x,y) 45#define calloc(x,y) codec_calloc(x,y)
45#define realloc(x,y) codec_realloc(x,y) 46#define realloc(x,y) codec_realloc(x,y)
46#define free(x) codec_free(x) 47#define free(x) codec_free(x)
48#undef alloca
47#define alloca(x) __builtin_alloca(x) 49#define alloca(x) __builtin_alloca(x)
48 50
49void* codec_malloc(size_t size); 51void* codec_malloc(size_t size);
@@ -59,7 +61,11 @@ void *memmove(void *s1, const void *s2, size_t n);
59size_t strlen(const char *s); 61size_t strlen(const char *s);
60char *strcpy(char *dest, const char *src); 62char *strcpy(char *dest, const char *src);
61char *strcat(char *dest, const char *src); 63char *strcat(char *dest, const char *src);
62int strcmp(const char *, const char *); 64
65/* on some platforms strcmp() seems to be a tricky define which
66 * breaks if we write down strcmp's prototype */
67#undef strcmp
68int strcmp(const char *s1, const char *s2);
63 69
64void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); 70void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
65 71
diff --git a/apps/codecs/lib/tlsf/src/tlsf.c b/apps/codecs/lib/tlsf/src/tlsf.c
index 6d15c3a3f6..570e472607 100644
--- a/apps/codecs/lib/tlsf/src/tlsf.c
+++ b/apps/codecs/lib/tlsf/src/tlsf.c
@@ -165,7 +165,7 @@
165#endif 165#endif
166 166
167#if defined(ROCKBOX) && defined(SIMULATOR) || !defined(ROCKBOX) 167#if defined(ROCKBOX) && defined(SIMULATOR) || !defined(ROCKBOX)
168int printf(char*, ...); 168int printf(const char* fmt, ...);
169#define PRINT_MSG(fmt, args...) printf(fmt, ## args) 169#define PRINT_MSG(fmt, args...) printf(fmt, ## args)
170#define ERROR_MSG(fmt, args...) printf(fmt, ## args) 170#define ERROR_MSG(fmt, args...) printf(fmt, ## args)
171#else 171#else
diff --git a/apps/codecs/lib/tlsf/src/tlsf.h b/apps/codecs/lib/tlsf/src/tlsf.h
index 5d016f4369..4feb5c42cc 100644
--- a/apps/codecs/lib/tlsf/src/tlsf.h
+++ b/apps/codecs/lib/tlsf/src/tlsf.h
@@ -19,7 +19,7 @@
19#ifndef _TLSF_H_ 19#ifndef _TLSF_H_
20#define _TLSF_H_ 20#define _TLSF_H_
21 21
22#include <sys/types.h> 22#include <string.h> /* defines size_t */
23 23
24extern size_t init_memory_pool(size_t, void *); 24extern size_t init_memory_pool(size_t, void *);
25extern size_t get_used_size(void *); 25extern size_t get_used_size(void *);
diff --git a/apps/codecs/libatrac/main.c b/apps/codecs/libatrac/main.c
index e0a3f8507d..30307c2946 100644
--- a/apps/codecs/libatrac/main.c
+++ b/apps/codecs/libatrac/main.c
@@ -1,6 +1,6 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdint.h> 2#include <stdint.h>
3#include <sys/types.h> 3#include <inttypes.h>
4#include <sys/stat.h> 4#include <sys/stat.h>
5#include <fcntl.h> 5#include <fcntl.h>
6#include <unistd.h> 6#include <unistd.h>
diff --git a/apps/codecs/libcook/main.c b/apps/codecs/libcook/main.c
index 25e263dd60..928cad298e 100644
--- a/apps/codecs/libcook/main.c
+++ b/apps/codecs/libcook/main.c
@@ -19,7 +19,7 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include <stdint.h> 21#include <stdint.h>
22#include <sys/types.h> 22#include <inttypes.h>
23#include <sys/stat.h> 23#include <sys/stat.h>
24#include <fcntl.h> 24#include <fcntl.h>
25#include <unistd.h> 25#include <unistd.h>
diff --git a/apps/codecs/libfaad/common.h b/apps/codecs/libfaad/common.h
index 658e92f23f..01164e3746 100644
--- a/apps/codecs/libfaad/common.h
+++ b/apps/codecs/libfaad/common.h
@@ -185,7 +185,7 @@ typedef float float32_t;
185 185
186#include <stdio.h> 186#include <stdio.h>
187#ifdef HAVE_SYS_TYPES_H 187#ifdef HAVE_SYS_TYPES_H
188# include <sys/types.h> 188# include "inttypes.h"
189#endif 189#endif
190#ifdef HAVE_SYS_STAT_H 190#ifdef HAVE_SYS_STAT_H
191# include <sys/stat.h> 191# include <sys/stat.h>
diff --git a/apps/codecs/libmad/libmad.make b/apps/codecs/libmad/libmad.make
index c5b197ead8..331ee8916f 100644
--- a/apps/codecs/libmad/libmad.make
+++ b/apps/codecs/libmad/libmad.make
@@ -11,7 +11,7 @@
11# (one for codec, one for mpegplayer) 11# (one for codec, one for mpegplayer)
12# so a little trickery is necessary 12# so a little trickery is necessary
13 13
14MADFLAGS = $(CODECFLAGS) -UDEBUG -DNDEBUG -O2 -I$(APPSDIR)/codecs/libmad 14MADFLAGS = $(CODECFLAGS) -UDEBUG -DNDEBUG -O2 -I$(APPSDIR)/codecs/libmad -DHAVE_LIMITS_H
15MPEGMADFLAGS = $(MADFLAGS) -DMPEGPLAYER 15MPEGMADFLAGS = $(MADFLAGS) -DMPEGPLAYER
16 16
17# libmad 17# libmad
diff --git a/apps/codecs/libpcm/adpcm_seek.h b/apps/codecs/libpcm/adpcm_seek.h
index 66ec390097..2dd3f000b1 100644
--- a/apps/codecs/libpcm/adpcm_seek.h
+++ b/apps/codecs/libpcm/adpcm_seek.h
@@ -21,9 +21,9 @@
21#ifndef CODEC_LIBPCM_ADPCM_SEEK_H 21#ifndef CODEC_LIBPCM_ADPCM_SEEK_H
22#define CODEC_LIBPCM_ADPCM_SEEK_H 22#define CODEC_LIBPCM_ADPCM_SEEK_H
23 23
24#include <sys/types.h>
25#include <stdbool.h> 24#include <stdbool.h>
26#include <inttypes.h> 25#include <inttypes.h>
26#include <string.h>
27 27
28struct adpcm_data { 28struct adpcm_data {
29 int16_t pcmdata[2]; 29 int16_t pcmdata[2];
diff --git a/apps/codecs/libpcm/ima_adpcm_common.c b/apps/codecs/libpcm/ima_adpcm_common.c
index ff5051f166..724cce31b0 100644
--- a/apps/codecs/libpcm/ima_adpcm_common.c
+++ b/apps/codecs/libpcm/ima_adpcm_common.c
@@ -63,7 +63,7 @@ static const int index_tables[4][16] ICONST_ATTR = {
63}; 63};
64 64
65static int32_t pcmdata[2]; 65static int32_t pcmdata[2];
66static int8_t index[2]; 66static int8_t indices[2];
67 67
68static int adpcm_data_size; 68static int adpcm_data_size;
69static uint8_t step_mask; 69static uint8_t step_mask;
@@ -107,7 +107,7 @@ void set_decode_parameters(int channels, int32_t *init_pcmdata, int8_t *init_ind
107 for (ch = 0; ch < channels; ch++) 107 for (ch = 0; ch < channels; ch++)
108 { 108 {
109 pcmdata[ch] = init_pcmdata[ch]; 109 pcmdata[ch] = init_pcmdata[ch];
110 index[ch] = init_index[ch]; 110 indices[ch] = init_index[ch];
111 } 111 }
112} 112}
113 113
@@ -121,7 +121,7 @@ int16_t create_pcmdata(int ch, uint8_t nibble)
121{ 121{
122 int check_bit = 1 << step_shift; 122 int check_bit = 1 << step_shift;
123 int32_t delta = 0; 123 int32_t delta = 0;
124 int16_t step = step_table[index[ch]]; 124 int16_t step = step_table[indices[ch]];
125 125
126 do { 126 do {
127 if (nibble & check_bit) 127 if (nibble & check_bit)
@@ -136,8 +136,8 @@ int16_t create_pcmdata(int ch, uint8_t nibble)
136 else 136 else
137 pcmdata[ch] += delta; 137 pcmdata[ch] += delta;
138 138
139 index[ch] += use_index_table[nibble & step_mask]; 139 indices[ch] += use_index_table[nibble & step_mask];
140 CLIP(index[ch], 0, 88); 140 CLIP(indices[ch], 0, 88);
141 141
142 CLIP(pcmdata[ch], -32768, 32767); 142 CLIP(pcmdata[ch], -32768, 32767);
143 143
@@ -150,7 +150,7 @@ int16_t create_pcmdata(int ch, uint8_t nibble)
150int16_t create_pcmdata_size4(int ch, uint8_t nibble) 150int16_t create_pcmdata_size4(int ch, uint8_t nibble)
151{ 151{
152 int32_t delta; 152 int32_t delta;
153 int16_t step = step_table[index[ch]]; 153 int16_t step = step_table[indices[ch]];
154 154
155 delta = (step >> 3); 155 delta = (step >> 3);
156 if (nibble & 4) delta += step; 156 if (nibble & 4) delta += step;
@@ -162,8 +162,8 @@ int16_t create_pcmdata_size4(int ch, uint8_t nibble)
162 else 162 else
163 pcmdata[ch] += delta; 163 pcmdata[ch] += delta;
164 164
165 index[ch] += use_index_table[nibble & 0x07]; 165 indices[ch] += use_index_table[nibble & 0x07];
166 CLIP(index[ch], 0, 88); 166 CLIP(indices[ch], 0, 88);
167 167
168 CLIP(pcmdata[ch], -32768, 32767); 168 CLIP(pcmdata[ch], -32768, 32767);
169 169
diff --git a/apps/codecs/libpcm/ima_adpcm_common.h b/apps/codecs/libpcm/ima_adpcm_common.h
index 0a2129bdf2..46fd6083ec 100644
--- a/apps/codecs/libpcm/ima_adpcm_common.h
+++ b/apps/codecs/libpcm/ima_adpcm_common.h
@@ -21,7 +21,6 @@
21#ifndef CODEC_LIBPCM_IMA_ADPCM_COMMON_H 21#ifndef CODEC_LIBPCM_IMA_ADPCM_COMMON_H
22#define CODEC_LIBPCM_IMA_ADPCM_COMMON_H 22#define CODEC_LIBPCM_IMA_ADPCM_COMMON_H
23 23
24#include <sys/types.h>
25#include <stdbool.h> 24#include <stdbool.h>
26#include <inttypes.h> 25#include <inttypes.h>
27 26
diff --git a/apps/codecs/libpcm/pcm_common.h b/apps/codecs/libpcm/pcm_common.h
index 91c3ab7f1e..90e29c98ee 100644
--- a/apps/codecs/libpcm/pcm_common.h
+++ b/apps/codecs/libpcm/pcm_common.h
@@ -21,9 +21,9 @@
21#ifndef CODEC_LIBPCM_PCM_COMMON_H 21#ifndef CODEC_LIBPCM_PCM_COMMON_H
22#define CODEC_LIBPCM_PCM_COMMON_H 22#define CODEC_LIBPCM_PCM_COMMON_H
23 23
24#include <sys/types.h>
25#include <stdbool.h> 24#include <stdbool.h>
26#include <inttypes.h> 25#include <inttypes.h>
26#include <string.h>
27 27
28/* decoded pcm sample depth (sample 28bit + sign 1bit) */ 28/* decoded pcm sample depth (sample 28bit + sign 1bit) */
29#define PCM_OUTPUT_DEPTH 29 29#define PCM_OUTPUT_DEPTH 29
diff --git a/apps/codecs/librm/rm.c b/apps/codecs/librm/rm.c
index a179688e7a..b543da50d7 100644
--- a/apps/codecs/librm/rm.c
+++ b/apps/codecs/librm/rm.c
@@ -32,7 +32,7 @@
32#ifdef TEST 32#ifdef TEST
33#include <fcntl.h> 33#include <fcntl.h>
34#include <unistd.h> 34#include <unistd.h>
35#include <sys/types.h> 35#include "inttypes.h"
36#include <sys/stat.h> 36#include <sys/stat.h>
37 37
38int filesize(int fd) 38int filesize(int fd)
diff --git a/apps/codecs/libtremor/config-tremor.h b/apps/codecs/libtremor/config-tremor.h
index 8a68ce325f..abed96533b 100644
--- a/apps/codecs/libtremor/config-tremor.h
+++ b/apps/codecs/libtremor/config-tremor.h
@@ -7,6 +7,7 @@
7#define _ARM_ASSEM_ 7#define _ARM_ASSEM_
8#endif 8#endif
9 9
10#ifndef BYTE_ORDER
10#ifdef ROCKBOX_BIG_ENDIAN 11#ifdef ROCKBOX_BIG_ENDIAN
11#define BIG_ENDIAN 1 12#define BIG_ENDIAN 1
12#define LITTLE_ENDIAN 0 13#define LITTLE_ENDIAN 0
@@ -16,6 +17,7 @@
16#define LITTLE_ENDIAN 1 17#define LITTLE_ENDIAN 1
17#define BIG_ENDIAN 0 18#define BIG_ENDIAN 0
18#endif 19#endif
20#endif
19 21
20#ifndef ICODE_ATTR_TREMOR_MDCT 22#ifndef ICODE_ATTR_TREMOR_MDCT
21#define ICODE_ATTR_TREMOR_MDCT ICODE_ATTR 23#define ICODE_ATTR_TREMOR_MDCT ICODE_ATTR
diff --git a/apps/codecs/libtremor/ctype.c b/apps/codecs/libtremor/ctype.c
index 10468bc27d..359be61e5a 100644
--- a/apps/codecs/libtremor/ctype.c
+++ b/apps/codecs/libtremor/ctype.c
@@ -1 +1,3 @@
1#include "common/ctype.c" 1#ifndef SIMULATOR
2#include "libc/ctype.c"
3#endif
diff --git a/apps/codecs/libwavpack/words.c b/apps/codecs/libwavpack/words.c
index 6da716119c..c3ae50dcf4 100644
--- a/apps/codecs/libwavpack/words.c
+++ b/apps/codecs/libwavpack/words.c
@@ -141,7 +141,7 @@ void init_words (WavpackStream *wps)
141 CLEAR (wps->w); 141 CLEAR (wps->w);
142} 142}
143 143
144static int mylog2 (unsigned int32_t avalue); 144static int mylog2 (uint32_t avalue);
145 145
146// Read the median log2 values from the specifed metadata structure, convert 146// Read the median log2 values from the specifed metadata structure, convert
147// them back to 32-bit unsigned values and store them. If length is not 147// them back to 32-bit unsigned values and store them. If length is not
@@ -553,7 +553,7 @@ void send_words (int32_t *buffer, int nsamples, uint32_t flags,
553 if (sign) 553 if (sign)
554 value = ~value; 554 value = ~value;
555 555
556 if ((unsigned int32_t) value < GET_MED (0)) { 556 if ((uint32_t) value < GET_MED (0)) {
557 ones_count = low = 0; 557 ones_count = low = 0;
558 high = GET_MED (0) - 1; 558 high = GET_MED (0) - 1;
559 DEC_MED0 (); 559 DEC_MED0 ();
@@ -709,7 +709,7 @@ void flush_word (struct words_data *w, Bitstream *bs)
709// This function returns the log2 for the specified 32-bit unsigned value. 709// This function returns the log2 for the specified 32-bit unsigned value.
710// The maximum value allowed is about 0xff800000 and returns 8447. 710// The maximum value allowed is about 0xff800000 and returns 8447.
711 711
712static int mylog2 (unsigned int32_t avalue) 712static int mylog2 (uint32_t avalue)
713{ 713{
714 int dbits; 714 int dbits;
715 715