Remove various ABS() definitions with a single one using typeof (if using gcc) to...
[kugel-rb/myfork.git] / apps / codecs / lib / codeclib.h
blobe7f45d3572d7eba9340d95eb7b6467c17a51a25c
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 Dave Chapman
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "config.h"
23 #include "codecs.h"
24 #include <sys/types.h>
26 extern struct codec_api *ci;
27 extern size_t mem_ptr;
28 extern size_t bufsize;
29 extern unsigned char* mp3buf; /* The actual MP3 buffer from Rockbox */
30 extern unsigned char* mallocbuf; /* The free space after the codec in the codec buffer */
31 extern unsigned char* filebuf; /* The rest of the MP3 buffer */
33 /* Standard library functions that are used by the codecs follow here */
35 /* Get these functions 'out of the way' of the standard functions. Not doing
36 * so confuses the cygwin linker, and maybe others. These functions need to
37 * be implemented elsewhere */
38 #define malloc(x) codec_malloc(x)
39 #define calloc(x,y) codec_calloc(x,y)
40 #define realloc(x,y) codec_realloc(x,y)
41 #define free(x) codec_free(x)
42 #define alloca(x) __builtin_alloca(x)
44 void* codec_malloc(size_t size);
45 void* codec_calloc(size_t nmemb, size_t size);
46 void* codec_realloc(void* ptr, size_t size);
47 void codec_free(void* ptr);
49 void *memcpy(void *dest, const void *src, size_t n);
50 void *memset(void *s, int c, size_t n);
51 int memcmp(const void *s1, const void *s2, size_t n);
52 void *memmove(void *s1, const void *s2, size_t n);
54 size_t strlen(const char *s);
55 char *strcpy(char *dest, const char *src);
56 char *strcat(char *dest, const char *src);
57 int strcmp(const char *, const char *);
59 void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
61 /*MDCT library functions*/
63 extern void mdct_backward(int n, int32_t *in, int32_t *out);
65 #if defined(CPU_ARM) && (ARM_ARCH == 4)
66 /* optimised unsigned integer division for ARMv4, in IRAM */
67 unsigned udiv32_arm(unsigned a, unsigned b);
68 #define UDIV32(a, b) udiv32_arm(a, b)
69 #else
70 /* default */
71 #define UDIV32(a, b) (a / b)
72 #endif
74 /* Various codec helper functions */
76 int codec_init(void);
77 void codec_set_replaygain(struct mp3entry* id3);
79 #ifdef RB_PROFILE
80 void __cyg_profile_func_enter(void *this_fn, void *call_site)
81 NO_PROF_ATTR ICODE_ATTR;
82 void __cyg_profile_func_exit(void *this_fn, void *call_site)
83 NO_PROF_ATTR ICODE_ATTR;
84 #endif