From c6b3d38a156dd624760a8eb1bb374affd43b4f2a Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Thu, 20 Nov 2008 11:27:31 +0000 Subject: New makefile solution: A single invocation of 'make' to build the entire tree. Fully controlled dependencies give faster and more correct recompiles. Many #include lines adjusted to conform to the new standards. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19146 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libspeex/Makefile | 57 -------------------------------- apps/codecs/libspeex/bits.c | 2 +- apps/codecs/libspeex/cb_search.c | 6 ++++ apps/codecs/libspeex/cb_search.h | 2 +- apps/codecs/libspeex/config-speex.h | 2 +- apps/codecs/libspeex/filters.c | 5 +++ apps/codecs/libspeex/jitter.c | 6 ++-- apps/codecs/libspeex/libspeex.make | 60 ++++++++++++++++++++++++++++++++++ apps/codecs/libspeex/lsp.c | 1 + apps/codecs/libspeex/ltp.c | 13 +++++++- apps/codecs/libspeex/ltp.h | 2 +- apps/codecs/libspeex/ltp_arm4.h | 1 + apps/codecs/libspeex/modes.h | 4 +-- apps/codecs/libspeex/nb_celp.c | 4 +-- apps/codecs/libspeex/nb_celp.h | 4 +-- apps/codecs/libspeex/quant_lsp.h | 2 +- apps/codecs/libspeex/rockbox.h | 13 ++++++-- apps/codecs/libspeex/sb_celp.h | 2 +- apps/codecs/libspeex/speex/ogg.h | 2 +- apps/codecs/libspeex/speex_callbacks.c | 13 ++++++-- apps/codecs/libspeex/speex_header.c | 4 +-- apps/codecs/libspeex/stereo.c | 5 +-- 22 files changed, 127 insertions(+), 83 deletions(-) delete mode 100644 apps/codecs/libspeex/Makefile create mode 100644 apps/codecs/libspeex/libspeex.make (limited to 'apps/codecs/libspeex') diff --git a/apps/codecs/libspeex/Makefile b/apps/codecs/libspeex/Makefile deleted file mode 100644 index 3bda53dca7..0000000000 --- a/apps/codecs/libspeex/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# __________ __ ___. -# Open \______ \ ____ ____ | | _\_ |__ _______ ___ -# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / -# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < -# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ -# \/ \/ \/ \/ \/ -# $Id: Makefile,v 1.16 2006-09-02 22:34:13 bagder Exp $ -# - -INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ - -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR) - -ifdef APPEXTRA - INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) -endif - -SPEEXOPTS = -DHAVE_CONFIG_H -DSPEEX_DISABLE_ENCODER -DROCKBOX - -# We're faster on ARM-targets with -O1 instead of -O2 -ifeq ($(CPU),arm) - SPEEXOPTS += -O -else - SPEEXOPTS += -O2 -endif - -# We build Speex separately for use as a voice codec -ifdef ROCKBOX_VOICE_CODEC -EXTRA_DEFINES += -DROCKBOX_VOICE_CODEC -endif - -CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(SPEEXOPTS) $(TARGET) \ -$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} ${PROFILE_OPTS} -Wno-unused-parameter - -# This sets up 'SRC' based on the files mentioned in SOURCES -include $(TOOLSDIR)/makesrc.inc - -SOURCES = $(SRC) -OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o) -OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2)) -DEPFILE = $(OBJDIR)/dep-Speex -DIRS = - -all: $(OUTPUT) - -$(OUTPUT): $(OBJS) - @echo "AR+RANLIB $(notdir $@)" - @$(AR) ruv $@ $+ >/dev/null 2>&1 - -include $(TOOLSDIR)/make.inc - -clean: - @echo "cleaning Speex" - @rm -f $(OBJS) $(OUTPUT) $(DEPFILE) - -ifneq ($(MAKECMDGOALS),clean) --include $(DEPFILE) -endif diff --git a/apps/codecs/libspeex/bits.c b/apps/codecs/libspeex/bits.c index 78b38db44e..9d6cad8886 100644 --- a/apps/codecs/libspeex/bits.c +++ b/apps/codecs/libspeex/bits.c @@ -36,7 +36,7 @@ #include "config-speex.h" #endif -#include +#include "speex/speex_bits.h" #include "arch.h" #include "os_support.h" diff --git a/apps/codecs/libspeex/cb_search.c b/apps/codecs/libspeex/cb_search.c index d280757e59..8a190e535d 100644 --- a/apps/codecs/libspeex/cb_search.c +++ b/apps/codecs/libspeex/cb_search.c @@ -522,6 +522,9 @@ char *stack, spx_int32_t *seed ) { + (void)nsf; + (void)stack; + (void)seed; int i,j; VARDECL(int *ind); VARDECL(int *signs); @@ -609,6 +612,9 @@ char *stack, spx_int32_t *seed ) { + (void)par; + (void)bits; + (void)stack; int i; /* FIXME: This is bad, but I don't think the function ever gets called anyway */ for (i=0;i +#include "speex/speex_bits.h" #include "arch.h" /** Split codebook parameters. */ diff --git a/apps/codecs/libspeex/config-speex.h b/apps/codecs/libspeex/config-speex.h index 5241b4ecd8..f3b397f541 100644 --- a/apps/codecs/libspeex/config-speex.h +++ b/apps/codecs/libspeex/config-speex.h @@ -1,5 +1,5 @@ #ifndef ROCKBOX_VOICE_ENCODER -#include "../codec.h" +#include "codeclib.h" #include "autoconf.h" #else #define ICODE_ATTR diff --git a/apps/codecs/libspeex/filters.c b/apps/codecs/libspeex/filters.c index 44addc2406..09f93c2a59 100644 --- a/apps/codecs/libspeex/filters.c +++ b/apps/codecs/libspeex/filters.c @@ -353,6 +353,7 @@ void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t #ifndef OVERRIDE_IIR_MEM16 void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack) { + (void)stack; int i,j; spx_word16_t yi,nyi; @@ -497,6 +498,7 @@ void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_ all odd x[i] are zero -- well, actually they are left out of the array now N and M are multiples of 4 */ { + (void)stack; int i, j; int M2, N2; VARDECL(spx_word16_t *xx1); @@ -681,6 +683,9 @@ spx_word16_t comb_gain, /*gain of comb filter*/ char *stack ) { + (void)ak; + (void)p; + (void)stack; int i; VARDECL(spx_word16_t *iexc); spx_word16_t old_ener, new_ener; diff --git a/apps/codecs/libspeex/jitter.c b/apps/codecs/libspeex/jitter.c index 61bca75ce8..d9f6c67b86 100644 --- a/apps/codecs/libspeex/jitter.c +++ b/apps/codecs/libspeex/jitter.c @@ -55,9 +55,9 @@ TODO: #include "arch.h" -#include -#include -#include +#include "speex/speex.h" +#include "speex/speex_bits.h" +#include "speex/speex_jitter.h" #include "os_support.h" #ifndef NULL diff --git a/apps/codecs/libspeex/libspeex.make b/apps/codecs/libspeex/libspeex.make new file mode 100644 index 0000000000..a27d559a06 --- /dev/null +++ b/apps/codecs/libspeex/libspeex.make @@ -0,0 +1,60 @@ +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $ +# + +# we need to build two different speex libraries +# (one for codec, one for core voice) +# so a little trickery is necessary + +SPEEXFLAGS = $(filter-out -O%,$(CODECFLAGS)) \ + -DHAVE_CONFIG_H -DSPEEX_DISABLE_ENCODER \ + -I$(APPSDIR)/codecs/libspeex + +# libspeex is faster on ARM-targets with -O1 instead of -O2 +ifeq ($(CPU),arm) + SPEEXFLAGS += -O1 +else + SPEEXFLAGS += -O2 +endif + +VOICESPEEXFLAGS = $(filter-out -ffunction-sections, $(filter-out -DCODEC,$(SPEEXFLAGS))) -DROCKBOX_VOICE_CODEC + +# libspeex +SPEEXLIB := $(CODECDIR)/libspeex.a +SPEEXLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libspeex/SOURCES) +SPEEXLIB_OBJ := $(call c2obj, $(SPEEXLIB_SRC)) +OTHER_SRC += $(SPEEXLIB_SRC) + +$(SPEEXLIB): $(SPEEXLIB_OBJ) + $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1 + +# libspeex-voice +VOICESPEEXLIB := $(CODECDIR)/libspeex-voice.a +VOICESPEEXLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libspeex/SOURCES) +VOICESPEEXLIB_OBJ := $(subst .c,.o,$(subst .S,.o,$(subst $(ROOTDIR)/apps/codecs/libspeex,$(BUILDDIR)/apps/codecs/libspeex-voice,$(VOICESPEEXLIB_SRC)))) + +$(VOICESPEEXLIB): $(VOICESPEEXLIB_OBJ) + $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1 + +# pattern rules + +$(CODECDIR)/libspeex-voice/%.o : $(ROOTDIR)/apps/codecs/libspeex/%.c + $(SILENT)mkdir -p $(dir $@) + $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(VOICESPEEXFLAGS) -c $< -o $@ + +$(CODECDIR)/libspeex-voice/%.o : $(ROOTDIR)/apps/codecs/libspeex/%.S + $(SILENT)mkdir -p $(dir $@) + $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(VOICESPEEXFLAGS) -c $< -o $@ + +$(CODECDIR)/libspeex/%.o: $(ROOTDIR)/apps/codecs/libspeex/%.c + $(SILENT)mkdir -p $(dir $@) + $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SPEEXFLAGS) -c $< -o $@ + +$(CODECDIR)/libspeex/%.o: $(ROOTDIR)/apps/codecs/libspeex/%.S + $(SILENT)mkdir -p $(dir $@) + $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SPEEXFLAGS) -c $< -o $@ diff --git a/apps/codecs/libspeex/lsp.c b/apps/codecs/libspeex/lsp.c index 3973554cfb..edf480e8bc 100644 --- a/apps/codecs/libspeex/lsp.c +++ b/apps/codecs/libspeex/lsp.c @@ -409,6 +409,7 @@ void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) /* float *ak array of LPC coefficients */ /* int lpcrdr order of LPC coefficients */ { + (void)stack; int i,j; spx_word32_t xout1,xout2,xin; spx_word32_t mult, a; diff --git a/apps/codecs/libspeex/ltp.c b/apps/codecs/libspeex/ltp.c index 04c1115b3f..9f10bc09d8 100644 --- a/apps/codecs/libspeex/ltp.c +++ b/apps/codecs/libspeex/ltp.c @@ -38,7 +38,7 @@ #include "ltp.h" #include "stack_alloc.h" #include "filters.h" -#include +#include "speex/speex_bits.h" #include "math_approx.h" #include "os_support.h" @@ -674,6 +674,9 @@ spx_word16_t last_pitch_gain, int cdbk_offset ) { + (void)end; + (void)pitch_coef; + (void)stack; int i; int pitch; int gain_index; @@ -826,6 +829,14 @@ spx_word16_t last_pitch_gain, int cdbk_offset ) { + (void)end; + (void)par; + (void)bits; + (void)stack; + (void)count_lost; + (void)subframe_offset; + (void)last_pitch_gain; + (void)cdbk_offset; int i; #ifdef FIXED_POINT if (pitch_coef>63) diff --git a/apps/codecs/libspeex/ltp.h b/apps/codecs/libspeex/ltp.h index 1e435bc36e..872f072e4e 100644 --- a/apps/codecs/libspeex/ltp.h +++ b/apps/codecs/libspeex/ltp.h @@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include "speex/speex_bits.h" #include "arch.h" /** LTP parameters. */ diff --git a/apps/codecs/libspeex/ltp_arm4.h b/apps/codecs/libspeex/ltp_arm4.h index cdb94e603a..e1c60ad7d5 100644 --- a/apps/codecs/libspeex/ltp_arm4.h +++ b/apps/codecs/libspeex/ltp_arm4.h @@ -87,6 +87,7 @@ spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) #define OVERRIDE_PITCH_XCORR void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack) { + (void)stack; int i,j; for (i=0;i -#include +#include "speex/speex.h" +#include "speex/speex_bits.h" #include "arch.h" #define NB_SUBMODES 16 diff --git a/apps/codecs/libspeex/nb_celp.c b/apps/codecs/libspeex/nb_celp.c index d29b9ae540..31eaa06b6b 100644 --- a/apps/codecs/libspeex/nb_celp.c +++ b/apps/codecs/libspeex/nb_celp.c @@ -43,12 +43,12 @@ #include "filters.h" #include "stack_alloc.h" #include "vq.h" -#include +#include "speex/speex_bits.h" #include "vbr.h" #include "arch.h" #include "math_approx.h" #include "os_support.h" -#include +#include "speex/speex_callbacks.h" #ifdef VORBIS_PSYCHO #include "vorbis_psy.h" diff --git a/apps/codecs/libspeex/nb_celp.h b/apps/codecs/libspeex/nb_celp.h index 30abdee842..30edbefaeb 100644 --- a/apps/codecs/libspeex/nb_celp.h +++ b/apps/codecs/libspeex/nb_celp.h @@ -37,8 +37,8 @@ #define NB_CELP_H #include "modes.h" -#include -#include +#include "speex/speex_bits.h" +#include "speex/speex_callbacks.h" #include "vbr.h" #include "filters.h" diff --git a/apps/codecs/libspeex/quant_lsp.h b/apps/codecs/libspeex/quant_lsp.h index 3bf4d4021c..0fc206be6f 100644 --- a/apps/codecs/libspeex/quant_lsp.h +++ b/apps/codecs/libspeex/quant_lsp.h @@ -35,7 +35,7 @@ #ifndef QUANT_LSP_H #define QUANT_LSP_H -#include +#include "speex/speex_bits.h" #include "arch.h" #define MAX_LSP_SIZE 20 diff --git a/apps/codecs/libspeex/rockbox.h b/apps/codecs/libspeex/rockbox.h index 073bad5d98..459c8b532f 100644 --- a/apps/codecs/libspeex/rockbox.h +++ b/apps/codecs/libspeex/rockbox.h @@ -24,8 +24,7 @@ /* We don't want all this stuff if we're building encoder */ #ifndef ROCKBOX_VOICE_ENCODER -#include "../codec.h" -#include "../lib/codeclib.h" +#include "codeclib.h" #include "debug.h" #if !defined(ROCKBOX_VOICE_CODEC) @@ -35,6 +34,7 @@ #define DEBUGF ci->debugf #endif + #ifdef ROCKBOX_HAS_LOGF #undef LOGF #define LOGF ci->logf @@ -75,6 +75,9 @@ static inline void speex_free_scratch (void *ptr) #define OVERRIDE_SPEEX_FATAL 1 static inline void _speex_fatal(const char *str, const char *file, int line) { + (void)str; + (void)file; + (void)line; DEBUGF("Fatal error: %s\n", str); //exit(1); } @@ -82,24 +85,30 @@ static inline void _speex_fatal(const char *str, const char *file, int line) #define OVERRIDE_SPEEX_WARNING 1 static inline void speex_warning(const char *str) { + (void)str; DEBUGF("warning: %s\n", str); } #define OVERRIDE_SPEEX_WARNING_INT 1 static inline void speex_warning_int(const char *str, int val) { + (void)str; + (void)val; DEBUGF("warning: %s %d\n", str, val); } #define OVERRIDE_SPEEX_NOTIFY 1 static inline void speex_notify(const char *str) { + (void)str; DEBUGF("notice: %s\n", str); } #define OVERRIDE_SPEEX_PUTC 1 static inline void _speex_putc(int ch, void *file) { + (void)ch; + (void)file; //FILE *f = (FILE *)file; //printf("%c", ch); } diff --git a/apps/codecs/libspeex/sb_celp.h b/apps/codecs/libspeex/sb_celp.h index 51aa3d0e13..86078ea33e 100644 --- a/apps/codecs/libspeex/sb_celp.h +++ b/apps/codecs/libspeex/sb_celp.h @@ -37,7 +37,7 @@ #define SB_CELP_H #include "modes.h" -#include +#include "speex/speex_bits.h" #include "nb_celp.h" /**Structure representing the full state of the sub-band encoder*/ diff --git a/apps/codecs/libspeex/speex/ogg.h b/apps/codecs/libspeex/speex/ogg.h index dce8f96b42..d42851f10c 100644 --- a/apps/codecs/libspeex/speex/ogg.h +++ b/apps/codecs/libspeex/speex/ogg.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include "../../codec.h" +#include "codeclib.h" typedef short spx_ogg_int16_t; typedef unsigned short spx_ogg_uint16_t; diff --git a/apps/codecs/libspeex/speex_callbacks.c b/apps/codecs/libspeex/speex_callbacks.c index 58d7b7b92a..9ffe5245f1 100644 --- a/apps/codecs/libspeex/speex_callbacks.c +++ b/apps/codecs/libspeex/speex_callbacks.c @@ -36,7 +36,7 @@ #include "config-speex.h" #endif -#include +#include "speex/speex_callbacks.h" #include "arch.h" #include "os_support.h" @@ -74,6 +74,7 @@ int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *st int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data) { + (void)state; spx_int32_t m; m = speex_bits_unpack_unsigned(bits, 4); speex_encoder_ctl(data, SPEEX_SET_MODE, &m); @@ -82,6 +83,7 @@ int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data) int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data) { + (void)state; spx_int32_t m; m = speex_bits_unpack_unsigned(bits, 4); speex_encoder_ctl(data, SPEEX_SET_LOW_MODE, &m); @@ -90,6 +92,7 @@ int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data) int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data) { + (void)state; spx_int32_t m; m = speex_bits_unpack_unsigned(bits, 4); speex_encoder_ctl(data, SPEEX_SET_HIGH_MODE, &m); @@ -99,6 +102,7 @@ int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data #ifndef DISABLE_VBR int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data) { + (void)state; spx_int32_t vbr; vbr = speex_bits_unpack_unsigned(bits, 1); speex_encoder_ctl(data, SPEEX_SET_VBR, &vbr); @@ -108,6 +112,7 @@ int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data) int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data) { + (void)state; spx_int32_t enh; enh = speex_bits_unpack_unsigned(bits, 1); speex_decoder_ctl(data, SPEEX_SET_ENH, &enh); @@ -117,6 +122,7 @@ int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data) #ifndef DISABLE_VBR int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data) { + (void)state; float qual; qual = speex_bits_unpack_unsigned(bits, 4); speex_encoder_ctl(data, SPEEX_SET_VBR_QUALITY, &qual); @@ -126,6 +132,7 @@ int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *da int speex_std_char_handler(SpeexBits *bits, void *state, void *data) { + (void)state; unsigned char ch; ch = speex_bits_unpack_unsigned(bits, 8); _speex_putc(ch, data); @@ -133,11 +140,11 @@ int speex_std_char_handler(SpeexBits *bits, void *state, void *data) return 0; } - - /* Default handler for user callbacks: skip it */ int speex_default_user_handler(SpeexBits *bits, void *state, void *data) { + (void)state; + (void)data; int req_size = speex_bits_unpack_unsigned(bits, 4); speex_bits_advance(bits, 5+8*req_size); return 0; diff --git a/apps/codecs/libspeex/speex_header.c b/apps/codecs/libspeex/speex_header.c index 1d1d07731c..b0e98b7c9c 100644 --- a/apps/codecs/libspeex/speex_header.c +++ b/apps/codecs/libspeex/speex_header.c @@ -36,8 +36,8 @@ #endif #include "arch.h" -#include -#include +#include "speex/speex_header.h" +#include "speex/speex.h" #include "os_support.h" #ifndef NULL diff --git a/apps/codecs/libspeex/stereo.c b/apps/codecs/libspeex/stereo.c index 2dce283ac3..652d2a6e90 100644 --- a/apps/codecs/libspeex/stereo.c +++ b/apps/codecs/libspeex/stereo.c @@ -33,8 +33,8 @@ #include "config-speex.h" #endif -#include -#include +#include "speex/speex_stereo.h" +#include "speex/speex_callbacks.h" #include "math_approx.h" #include "vq.h" #include @@ -278,6 +278,7 @@ void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data) { + (void)state; RealSpeexStereoState *stereo; spx_word16_t sign=1, dexp; int tmp; -- cgit v1.2.3