summaryrefslogtreecommitdiffstats
path: root/lib/rbcodec/codecs
diff options
context:
space:
mode:
authorSean Bartell <wingedtachikoma@gmail.com>2011-10-30 12:05:04 -0400
committerNils Wallménius <nils@rockbox.org>2012-05-03 14:49:35 +0200
commitcadb3627fcc32cec3a97183c0a1462fe0ff04755 (patch)
treeed3ec41d5231a604a7c3d368dbf8172d9ab1ea0a /lib/rbcodec/codecs
parent5f0cb713615c844d9133f3664333a73816bbfd17 (diff)
downloadrockbox-cadb3627fcc32cec3a97183c0a1462fe0ff04755.tar.gz
rockbox-cadb3627fcc32cec3a97183c0a1462fe0ff04755.tar.bz2
rockbox-cadb3627fcc32cec3a97183c0a1462fe0ff04755.zip
Add rbcodecplatform.h and rbcodecconfig.h.
librbcodec users must provide these two files when the library is built. rbcodecconfig.h provides configuration #defines and basic types, and will be included by public librbcodec headers, so it must not conflict with the user's code. rbcodecplatform.h provides various OS functions, and will only be included by source files and private headers. This system is intended to provide maximum flexibility for use on embedded systems, where no operating system headers are included. Unix systems can just copy rbcodecconfig-example.h and rbcodecplatform-unix.h with minimal changes. Change-Id: I350a2274d173da391fd1ca00c4202e9760d91def Reviewed-on: http://gerrit.rockbox.org/143 Reviewed-by: Nils Wallménius <nils@rockbox.org> Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/codecs')
-rw-r--r--lib/rbcodec/codecs/codecs.h6
-rw-r--r--lib/rbcodec/codecs/lib/codeclib.h4
-rw-r--r--lib/rbcodec/codecs/lib/ffmpeg_bswap.h32
-rw-r--r--lib/rbcodec/codecs/lib/ffmpeg_get_bits.h9
-rw-r--r--lib/rbcodec/codecs/libffmpegFLAC/bitstream.h3
-rw-r--r--lib/rbcodec/codecs/libmad/frame.c1
-rw-r--r--lib/rbcodec/codecs/libmad/frame.h1
-rw-r--r--lib/rbcodec/codecs/libmad/libmad.make2
-rw-r--r--lib/rbcodec/codecs/libmusepack/mpcdec.h2
-rw-r--r--lib/rbcodec/codecs/libspeex/filters.c2
-rw-r--r--lib/rbcodec/codecs/libspeex/lsp.c2
-rw-r--r--lib/rbcodec/codecs/libspeex/ltp.c2
-rw-r--r--lib/rbcodec/codecs/libspeex/modes.c2
-rw-r--r--lib/rbcodec/codecs/libspeex/modes_wb.c2
-rw-r--r--lib/rbcodec/codecs/libspeex/nb_celp.c2
-rw-r--r--lib/rbcodec/codecs/libspeex/quant_lsp.c2
-rw-r--r--lib/rbcodec/codecs/libspeex/sb_celp.c2
-rw-r--r--lib/rbcodec/codecs/libspeex/speex.c2
-rw-r--r--lib/rbcodec/codecs/libspeex/stereo.c2
-rw-r--r--lib/rbcodec/codecs/libtremor/vorbisfile.c1
-rw-r--r--lib/rbcodec/codecs/libwavpack/bits.c1
21 files changed, 60 insertions, 22 deletions
diff --git a/lib/rbcodec/codecs/codecs.h b/lib/rbcodec/codecs/codecs.h
index 91ce8698ab..03167f55bf 100644
--- a/lib/rbcodec/codecs/codecs.h
+++ b/lib/rbcodec/codecs/codecs.h
@@ -27,11 +27,7 @@
#define NO_REDEFINES_PLEASE
#endif
-#include <stdbool.h>
-#include <stdlib.h>
-#include "strlcpy.h"
-#include "config.h"
-#include "system.h"
+#include "rbcodecconfig.h"
#include "metadata.h"
#include "audio.h"
#ifdef RB_PROFILE
diff --git a/lib/rbcodec/codecs/lib/codeclib.h b/lib/rbcodec/codecs/lib/codeclib.h
index d0f985b8e1..18c1043b8c 100644
--- a/lib/rbcodec/codecs/lib/codeclib.h
+++ b/lib/rbcodec/codecs/lib/codeclib.h
@@ -22,9 +22,7 @@
#ifndef __CODECLIB_H__
#define __CODECLIB_H__
-#include <inttypes.h>
-#include <string.h>
-#include "config.h"
+#include "platform.h"
#include "codecs.h"
#include "mdct.h"
#include "fft.h"
diff --git a/lib/rbcodec/codecs/lib/ffmpeg_bswap.h b/lib/rbcodec/codecs/lib/ffmpeg_bswap.h
index 24a2aab7ea..70176db215 100644
--- a/lib/rbcodec/codecs/lib/ffmpeg_bswap.h
+++ b/lib/rbcodec/codecs/lib/ffmpeg_bswap.h
@@ -6,6 +6,32 @@
#ifndef __BSWAP_H__
#define __BSWAP_H__
+#include "platform.h"
+
+#ifndef bswap_16
+#define bswap_16(x) swap16(x)
+#endif
+#ifndef bswap_32
+#define bswap_32(x) swap32(x)
+#endif
+
+#ifndef bswap_64
+static inline uint64_t ByteSwap64(uint64_t x)
+{
+ union {
+ uint64_t ll;
+ struct {
+ uint32_t l,h;
+ } l;
+ } r;
+ r.l.l = bswap_32 (x);
+ r.l.h = bswap_32 (x>>32);
+ return r.ll;
+}
+#define bswap_64(x) ByteSwap64(x)
+#endif
+
+#if 0
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
#else
@@ -13,9 +39,7 @@
#ifdef ROCKBOX
#include "codecs.h"
-/* rockbox' optimised inline functions */
-#define bswap_16(x) swap16(x)
-#define bswap_32(x) swap32(x)
+
static inline uint64_t ByteSwap64(uint64_t x)
{
@@ -127,7 +151,7 @@ static inline uint64_t ByteSwap64(uint64_t x)
#endif /* !ARCH_X86 */
#endif /* !HAVE_BYTESWAP_H */
-
+#endif
// be2me ... BigEndian to MachineEndian
// le2me ... LittleEndian to MachineEndian
diff --git a/lib/rbcodec/codecs/lib/ffmpeg_get_bits.h b/lib/rbcodec/codecs/lib/ffmpeg_get_bits.h
index 04eda021a7..e6f80ff45c 100644
--- a/lib/rbcodec/codecs/lib/ffmpeg_get_bits.h
+++ b/lib/rbcodec/codecs/lib/ffmpeg_get_bits.h
@@ -26,8 +26,9 @@
#ifndef AVCODEC_GET_BITS_H
#define AVCODEC_GET_BITS_H
-#include <stdint.h>
-#include <stdlib.h>
+//#include <stdint.h>
+//#include <stdlib.h>
+#include "platform.h"
#include "ffmpeg_intreadwrite.h"
//#include <assert.h>
//#include "libavutil/bswap.h"
@@ -39,8 +40,12 @@
#include "codecs.h"
/* rockbox' optimised inline functions */
+#ifndef bswap_16
#define bswap_16(x) swap16(x)
+#endif
+#ifndef bswap_32
#define bswap_32(x) swap32(x)
+#endif
#ifdef ROCKBOX_BIG_ENDIAN
#define be2me_16(x) (x)
diff --git a/lib/rbcodec/codecs/libffmpegFLAC/bitstream.h b/lib/rbcodec/codecs/libffmpegFLAC/bitstream.h
index 5fc3460c8e..2ec54c42fa 100644
--- a/lib/rbcodec/codecs/libffmpegFLAC/bitstream.h
+++ b/lib/rbcodec/codecs/libffmpegFLAC/bitstream.h
@@ -10,8 +10,7 @@
#include "ffmpeg_get_bits.h"
#ifndef BUILD_STANDALONE
- #include <config.h>
- #include <system.h>
+ #include "platform.h"
#else
#include <stdio.h>
#define IBSS_ATTR
diff --git a/lib/rbcodec/codecs/libmad/frame.c b/lib/rbcodec/codecs/libmad/frame.c
index f17306285c..c1cc10396b 100644
--- a/lib/rbcodec/codecs/libmad/frame.c
+++ b/lib/rbcodec/codecs/libmad/frame.c
@@ -28,7 +28,6 @@
# include "bit.h"
# include "stream.h"
# include "frame.h"
-# include "timer.h"
# include "layer12.h"
# include "layer3.h"
# include "codeclib.h"
diff --git a/lib/rbcodec/codecs/libmad/frame.h b/lib/rbcodec/codecs/libmad/frame.h
index b1c6e0289d..a8eb2b51f9 100644
--- a/lib/rbcodec/codecs/libmad/frame.h
+++ b/lib/rbcodec/codecs/libmad/frame.h
@@ -23,7 +23,6 @@
# define LIBMAD_FRAME_H
# include "fixed.h"
-# include "timer.h"
# include "stream.h"
enum mad_layer {
diff --git a/lib/rbcodec/codecs/libmad/libmad.make b/lib/rbcodec/codecs/libmad/libmad.make
index 2a8c7b220f..16b2bd76a9 100644
--- a/lib/rbcodec/codecs/libmad/libmad.make
+++ b/lib/rbcodec/codecs/libmad/libmad.make
@@ -13,7 +13,7 @@
# Extract optimization level ('-O') from compile flags. Will be set later.
MADFLAGS = $(filter-out -O%,$(CODECFLAGS)) -I$(RBCODECLIB_DIR)/codecs/libmad
-MADFLAGS += -UDEBUG -DNDEBUG -DHAVE_LIMITS_H
+MADFLAGS += -UDEBUG -DNDEBUG -DHAVE_LIMITS_H -DHAVE_ASSERT_H
# libmad is faster on ARM-targets with -O1 than -O2
ifeq ($(ARCH),arch_arm)
diff --git a/lib/rbcodec/codecs/libmusepack/mpcdec.h b/lib/rbcodec/codecs/libmusepack/mpcdec.h
index 85536e726a..02003cb01b 100644
--- a/lib/rbcodec/codecs/libmusepack/mpcdec.h
+++ b/lib/rbcodec/codecs/libmusepack/mpcdec.h
@@ -39,9 +39,9 @@
#pragma once
#endif
+#include "platform.h"
#include "reader.h"
#include "streaminfo.h"
-#include "config.h"
#ifdef __cplusplus
extern "C" {
diff --git a/lib/rbcodec/codecs/libspeex/filters.c b/lib/rbcodec/codecs/libspeex/filters.c
index 09f93c2a59..7c4c90a636 100644
--- a/lib/rbcodec/codecs/libspeex/filters.c
+++ b/lib/rbcodec/codecs/libspeex/filters.c
@@ -39,7 +39,9 @@
#include "arch.h"
#include "math_approx.h"
#include "ltp.h"
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#ifdef _USE_SSE
#include "filters_sse.h"
diff --git a/lib/rbcodec/codecs/libspeex/lsp.c b/lib/rbcodec/codecs/libspeex/lsp.c
index 8408d782aa..83365a8639 100644
--- a/lib/rbcodec/codecs/libspeex/lsp.c
+++ b/lib/rbcodec/codecs/libspeex/lsp.c
@@ -83,7 +83,9 @@ Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point,
#include "config-speex.h"
#endif
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#include "lsp.h"
#include "stack_alloc.h"
#include "math_approx.h"
diff --git a/lib/rbcodec/codecs/libspeex/ltp.c b/lib/rbcodec/codecs/libspeex/ltp.c
index 9f10bc09d8..c81e8eb2f3 100644
--- a/lib/rbcodec/codecs/libspeex/ltp.c
+++ b/lib/rbcodec/codecs/libspeex/ltp.c
@@ -34,7 +34,9 @@
#include "config-speex.h"
#endif
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#include "ltp.h"
#include "stack_alloc.h"
#include "filters.h"
diff --git a/lib/rbcodec/codecs/libspeex/modes.c b/lib/rbcodec/codecs/libspeex/modes.c
index d1046f1cfb..a58c0786dd 100644
--- a/lib/rbcodec/codecs/libspeex/modes.c
+++ b/lib/rbcodec/codecs/libspeex/modes.c
@@ -44,7 +44,9 @@
#include "nb_celp.h"
#include "vbr.h"
#include "arch.h"
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#ifndef NULL
#define NULL 0
diff --git a/lib/rbcodec/codecs/libspeex/modes_wb.c b/lib/rbcodec/codecs/libspeex/modes_wb.c
index 93922afa2f..4055a2b074 100644
--- a/lib/rbcodec/codecs/libspeex/modes_wb.c
+++ b/lib/rbcodec/codecs/libspeex/modes_wb.c
@@ -44,7 +44,9 @@
#include "nb_celp.h"
#include "vbr.h"
#include "arch.h"
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#include "os_support.h"
diff --git a/lib/rbcodec/codecs/libspeex/nb_celp.c b/lib/rbcodec/codecs/libspeex/nb_celp.c
index 364f987472..a385500f90 100644
--- a/lib/rbcodec/codecs/libspeex/nb_celp.c
+++ b/lib/rbcodec/codecs/libspeex/nb_celp.c
@@ -33,7 +33,9 @@
#include "config-speex.h"
#endif
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#include "nb_celp.h"
#include "lpc.h"
#include "lsp.h"
diff --git a/lib/rbcodec/codecs/libspeex/quant_lsp.c b/lib/rbcodec/codecs/libspeex/quant_lsp.c
index 9b9104c842..c79942cd59 100644
--- a/lib/rbcodec/codecs/libspeex/quant_lsp.c
+++ b/lib/rbcodec/codecs/libspeex/quant_lsp.c
@@ -36,7 +36,9 @@
#include "quant_lsp.h"
#include "os_support.h"
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
diff --git a/lib/rbcodec/codecs/libspeex/sb_celp.c b/lib/rbcodec/codecs/libspeex/sb_celp.c
index b28744812f..45c8417022 100644
--- a/lib/rbcodec/codecs/libspeex/sb_celp.c
+++ b/lib/rbcodec/codecs/libspeex/sb_celp.c
@@ -33,7 +33,9 @@
#include "config-speex.h"
#endif
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#include "sb_celp.h"
#include "filters.h"
#include "lpc.h"
diff --git a/lib/rbcodec/codecs/libspeex/speex.c b/lib/rbcodec/codecs/libspeex/speex.c
index 0dcfb3f7f6..92e41f52ae 100644
--- a/lib/rbcodec/codecs/libspeex/speex.c
+++ b/lib/rbcodec/codecs/libspeex/speex.c
@@ -37,7 +37,9 @@
#endif
#include "modes.h"
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#include "os_support.h"
#ifndef NULL
diff --git a/lib/rbcodec/codecs/libspeex/stereo.c b/lib/rbcodec/codecs/libspeex/stereo.c
index 652d2a6e90..0aca1050fa 100644
--- a/lib/rbcodec/codecs/libspeex/stereo.c
+++ b/lib/rbcodec/codecs/libspeex/stereo.c
@@ -37,7 +37,9 @@
#include "speex/speex_callbacks.h"
#include "math_approx.h"
#include "vq.h"
+#ifndef FIXED_POINT
#include <math.h>
+#endif
#include "os_support.h"
typedef struct RealSpeexStereoState {
diff --git a/lib/rbcodec/codecs/libtremor/vorbisfile.c b/lib/rbcodec/codecs/libtremor/vorbisfile.c
index 271e5a09e3..688a864077 100644
--- a/lib/rbcodec/codecs/libtremor/vorbisfile.c
+++ b/lib/rbcodec/codecs/libtremor/vorbisfile.c
@@ -21,7 +21,6 @@
#include <errno.h>
#include <string.h>
#include <math.h>
-#include "system.h"
#include "ivorbiscodec.h"
#include "ivorbisfile.h"
diff --git a/lib/rbcodec/codecs/libwavpack/bits.c b/lib/rbcodec/codecs/libwavpack/bits.c
index 0f0e79c292..6d81b22773 100644
--- a/lib/rbcodec/codecs/libwavpack/bits.c
+++ b/lib/rbcodec/codecs/libwavpack/bits.c
@@ -15,7 +15,6 @@
// the malloc() system is provided.
#include "wavpack.h"
-#include "system.h"
#include <string.h>