codeclib.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /***************************************************************************
  2. * __________ __ ___.
  3. * Open \______ \ ____ ____ | | _\_ |__ _______ ___
  4. * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
  5. * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
  6. * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
  7. * \/ \/ \/ \/ \/
  8. * $Id: codeclib.h 19704 2009-01-07 09:53:46Z zagor $
  9. *
  10. * Copyright (C) 2005 Dave Chapman
  11. *
  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.
  16. *
  17. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  18. * KIND, either express or implied.
  19. *
  20. ****************************************************************************/
  21. #ifndef __CODECLIB_H__
  22. #define __CODECLIB_H__
  23. #include "ffmpeg_config.h"
  24. // #include "codecs.h"
  25. // #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 */
  32. /* Standard library functions that are used by the codecs follow here */
  33. /* Get these functions 'out of the way' of the standard functions. Not doing
  34. * so confuses the cygwin linker, and maybe others. These functions need to
  35. * be implemented elsewhere */
  36. #define malloc(x) codec_malloc(x)
  37. #define calloc(x,y) codec_calloc(x,y)
  38. #define realloc(x,y) codec_realloc(x,y)
  39. #define free(x) codec_free(x)
  40. #define alloca(x) __builtin_alloca(x)
  41. void* codec_malloc(size_t size);
  42. void* codec_calloc(size_t nmemb, size_t size);
  43. void* codec_realloc(void* ptr, size_t size);
  44. void codec_free(void* ptr);
  45. void *memcpy(void *dest, const void *src, size_t n);
  46. void *memset(void *s, int c, size_t n);
  47. int memcmp(const void *s1, const void *s2, size_t n);
  48. void *memmove(void *s1, const void *s2, size_t n);
  49. size_t strlen(const char *s);
  50. char *strcpy(char *dest, const char *src);
  51. char *strcat(char *dest, const char *src);
  52. int strcmp(const char *, const char *);
  53. void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
  54. #define abs(x) ((x)>0?(x):-(x))
  55. #define labs(x) abs(x)
  56. /*MDCT library functions*/
  57. extern void mdct_backward(int n, int32_t *in, int32_t *out);
  58. #if defined(CPU_ARM) && (ARM_ARCH == 4)
  59. /* optimised unsigned integer division for ARMv4, in IRAM */
  60. unsigned udiv32_arm(unsigned a, unsigned b);
  61. #define UDIV32(a, b) udiv32_arm(a, b)
  62. #else
  63. /* default */
  64. #define UDIV32(a, b) (a / b)
  65. #endif
  66. #endif