From 65458ee71ca741fbed1bff7e358760bb480b85e9 Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Fri, 16 Nov 2007 15:35:37 +0000 Subject: Speex encoder specially tailored to create voice UI snippets. Small fixups to libspeex to allow it to be built. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15640 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libspeex/Makefile | 2 +- apps/codecs/libspeex/SOURCES | 10 ++++++++++ apps/codecs/libspeex/bits.c | 2 +- apps/codecs/libspeex/config-speex.h | 14 ++++++++++++++ apps/codecs/libspeex/rockbox.h | 5 +++++ apps/codecs/libspeex/speex_header.c | 2 +- 6 files changed, 32 insertions(+), 3 deletions(-) (limited to 'apps/codecs') diff --git a/apps/codecs/libspeex/Makefile b/apps/codecs/libspeex/Makefile index 35a8535..3bda53d 100644 --- a/apps/codecs/libspeex/Makefile +++ b/apps/codecs/libspeex/Makefile @@ -14,7 +14,7 @@ ifdef APPEXTRA INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) endif -SPEEXOPTS = -DHAVE_CONFIG_H -DSPEEX_DISABLE_ENCODER +SPEEXOPTS = -DHAVE_CONFIG_H -DSPEEX_DISABLE_ENCODER -DROCKBOX # We're faster on ARM-targets with -O1 instead of -O2 ifeq ($(CPU),arm) diff --git a/apps/codecs/libspeex/SOURCES b/apps/codecs/libspeex/SOURCES index 40ea538..f036734 100644 --- a/apps/codecs/libspeex/SOURCES +++ b/apps/codecs/libspeex/SOURCES @@ -24,12 +24,22 @@ speex.c speex_callbacks.c speex_header.c #ifndef ROCKBOX_VOICE_CODEC +#ifndef ROCKBOX_VOICE_ENCODER oggframing.c +#endif stereo.c #endif +#ifdef ROCKBOX_VOICE_ENCODER +lpc.c +vbr.c +vq.c +window.c +resample.c +#else #ifdef CPU_COLDFIRE filters_cf.S ltp_cf.S #elif defined(CPU_ARM) filters_arm4.S #endif +#endif diff --git a/apps/codecs/libspeex/bits.c b/apps/codecs/libspeex/bits.c index d4b02a5..e460a39 100644 --- a/apps/codecs/libspeex/bits.c +++ b/apps/codecs/libspeex/bits.c @@ -106,7 +106,7 @@ void speex_bits_rewind(SpeexBits *bits) bits->overflow=0; } -#if 0 +#ifndef SPEEX_VOICE_ENCODER void speex_bits_read_from(SpeexBits *bits, char *chars, int len) { int i; diff --git a/apps/codecs/libspeex/config-speex.h b/apps/codecs/libspeex/config-speex.h index 1378fc2..ad1393f 100644 --- a/apps/codecs/libspeex/config-speex.h +++ b/apps/codecs/libspeex/config-speex.h @@ -1,8 +1,16 @@ +#ifndef ROCKBOX_VOICE_ENCODER #include "../codec.h" #include "autoconf.h" +#else +#define ICODE_ATTR +#define IDATA_ATTR +#define IBSS_ATTR +#define ICONST_ATTR +#endif /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ +#ifndef ROCKBOX_VOICE_ENCODER /* Make use of ARM4E assembly optimizations */ #if defined(CPU_ARM) #define ARM4_ASM @@ -15,6 +23,7 @@ /* Make use of Blackfin assembly optimizations */ /* #undef BFIN_ASM */ +#endif /* ROCKBOX_VOICE_ENCODER */ /* Disable wideband codec */ /* #undef DISABLE_WIDEBAND */ @@ -28,8 +37,13 @@ /* Debug fixed-point implementation */ /* #undef FIXED_DEBUG */ +#ifndef ROCKBOX_VOICE_ENCODER /* Compile target codec as fixed point */ #define FIXED_POINT +#else +/* Compile voice clip encoder as floating point */ +#define FLOATING_POINT +#endif /* Define to 1 if you have the header file. */ /* #undef HAVE_DLFCN_H */ diff --git a/apps/codecs/libspeex/rockbox.h b/apps/codecs/libspeex/rockbox.h index 0f8c6d9..0e0d3ed 100644 --- a/apps/codecs/libspeex/rockbox.h +++ b/apps/codecs/libspeex/rockbox.h @@ -19,6 +19,9 @@ #ifndef SPEEX_ROCKBOX_H #define SPEEX_ROCKBOX_H +/* We don't want all this stuff if we're building encoder */ +#ifndef ROCKBOX_VOICE_ENCODER + #include "../codec.h" #include "../lib/codeclib.h" @@ -106,5 +109,7 @@ static inline void _speex_putc(int ch, void *file) //printf("%c", ch); } +#endif /* ROCKBOX_VOICE_ENCODER */ + #endif diff --git a/apps/codecs/libspeex/speex_header.c b/apps/codecs/libspeex/speex_header.c index eb4c199..30f4720 100644 --- a/apps/codecs/libspeex/speex_header.c +++ b/apps/codecs/libspeex/speex_header.c @@ -47,7 +47,7 @@ /** Convert little endian */ static inline spx_int32_t le_int(spx_int32_t i) { -#if 1 +#ifdef ROCKBOX return letoh32(i); #elif !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) ) spx_uint32_t ui, ret; -- cgit v1.1