summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/codecs/libwma/Makefile2
-rw-r--r--apps/codecs/libwma/bitstream.h2
-rw-r--r--apps/codecs/libwma/bswap.h25
-rw-r--r--apps/codecs/libwma/ffmpeg_config.h11
4 files changed, 34 insertions, 6 deletions
diff --git a/apps/codecs/libwma/Makefile b/apps/codecs/libwma/Makefile
index 0d7f966737..91ea49b1fb 100644
--- a/apps/codecs/libwma/Makefile
+++ b/apps/codecs/libwma/Makefile
@@ -14,7 +14,7 @@ ifdef APPEXTRA
INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
endif
-WMAOPTS = -O2
+WMAOPTS = -O2 -DROCKBOX
CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(WMAOPTS) $(TARGET) \
$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS) -DCODEC=1
diff --git a/apps/codecs/libwma/bitstream.h b/apps/codecs/libwma/bitstream.h
index c02845e09b..77ccff695e 100644
--- a/apps/codecs/libwma/bitstream.h
+++ b/apps/codecs/libwma/bitstream.h
@@ -203,7 +203,7 @@ typedef struct RL_VLC_ELEM {
#endif
/* used to avoid missaligned exceptions on some archs (alpha, ...) */
-#if defined(ARCH_X86)
+#if defined(ARCH_X86) || defined(CPU_COLDFIRE)
# define unaligned16(a) (*(const uint16_t*)(a))
# define unaligned32(a) (*(const uint32_t*)(a))
# define unaligned64(a) (*(const uint64_t*)(a))
diff --git a/apps/codecs/libwma/bswap.h b/apps/codecs/libwma/bswap.h
index 460f7abd40..33377cfcba 100644
--- a/apps/codecs/libwma/bswap.h
+++ b/apps/codecs/libwma/bswap.h
@@ -10,7 +10,28 @@
#include <byteswap.h>
#else
-#ifdef ARCH_X86
+#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)
+{
+ 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)
+
+#elif defined(ARCH_X86)
static inline unsigned short ByteSwap16(unsigned short x)
{
__asm("xchgb %b0,%h0" :
@@ -83,7 +104,7 @@ static inline uint64_t ByteSwap64(uint64_t x)
#else
#define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8)
-
+
// code from bits/byteswap.h (C) 1997, 1998 Free Software Foundation, Inc.
#define bswap_32(x) \
diff --git a/apps/codecs/libwma/ffmpeg_config.h b/apps/codecs/libwma/ffmpeg_config.h
index 40815cb54b..12b0666e42 100644
--- a/apps/codecs/libwma/ffmpeg_config.h
+++ b/apps/codecs/libwma/ffmpeg_config.h
@@ -1,7 +1,14 @@
/* Automatically generated by configure - do not modify */
-#ifndef _CONFIG_H
-#define _CONFIG_H
+#ifndef _FFMPEG_CONFIG_H
+#define _FFMPEG_CONFIG_H
+#include "codecs.h"
+#ifdef CPU_ARM
#define CONFIG_ALIGN 1
+#endif
+
+#ifdef ROCKBOX_BIG_ENDIAN
+#define WORDS_BIGENDIAN
+#endif
#endif