New makefile solution: A single invocation of 'make' to build the entire tree. Fully...
[kugel-rb.git] / apps / codecs / lib / codeclib.h
blob1df85d6beed87ce07fe7d25c98b75beee719bf75
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 "system.h"
25 #include <sys/types.h>
27 extern struct codec_api *ci;
28 extern size_t mem_ptr;
29 extern size_t bufsize;
30 extern unsigned char* mp3buf; /* The actual MP3 buffer from Rockbox */
31 extern unsigned char* mallocbuf; /* The free space after the codec in the codec buffer */
32 extern unsigned char* filebuf; /* The rest of the MP3 buffer */
34 /* Standard library functions that are used by the codecs follow here */
36 /* Get these functions 'out of the way' of the standard functions. Not doing
37 * so confuses the cygwin linker, and maybe others. These functions need to
38 * be implemented elsewhere */
39 #define malloc(x) codec_malloc(x)
40 #define calloc(x,y) codec_calloc(x,y)
41 #define realloc(x,y) codec_realloc(x,y)
42 #define free(x) codec_free(x)
43 #define alloca(x) __builtin_alloca(x)
45 void* codec_malloc(size_t size);
46 void* codec_calloc(size_t nmemb, size_t size);
47 void* codec_realloc(void* ptr, size_t size);
48 void codec_free(void* ptr);
50 void *memcpy(void *dest, const void *src, size_t n);
51 void *memset(void *s, int c, size_t n);
52 int memcmp(const void *s1, const void *s2, size_t n);
53 void *memmove(void *s1, const void *s2, size_t n);
55 size_t strlen(const char *s);
56 char *strcpy(char *dest, const char *src);
57 char *strcat(char *dest, const char *src);
58 int strcmp(const char *, const char *);
60 void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
62 #define abs(x) ((x)>0?(x):-(x))
63 #define labs(x) abs(x)
65 /*MDCT library functions*/
67 extern void mdct_backward(int n, int32_t *in, int32_t *out);
69 #if defined(CPU_ARM) && (ARM_ARCH == 4)
70 /* optimised unsigned integer division for ARMv4, in IRAM */
71 unsigned udiv32_arm(unsigned a, unsigned b);
72 #define UDIV32(a, b) udiv32_arm(a, b)
73 #else
74 /* default */
75 #define UDIV32(a, b) (a / b)
76 #endif
78 /* Various codec helper functions */
80 int codec_init(void);
81 void codec_set_replaygain(struct mp3entry* id3);
83 #ifdef RB_PROFILE
84 void __cyg_profile_func_enter(void *this_fn, void *call_site)
85 NO_PROF_ATTR ICODE_ATTR;
86 void __cyg_profile_func_exit(void *this_fn, void *call_site)
87 NO_PROF_ATTR ICODE_ATTR;
88 #endif