From 13f08d70fd5ba237ae53aad1de8bb3d613010246 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Sun, 29 Nov 2009 18:11:49 +0000 Subject: Enable strict aliasing optimizations for codecs on gcc versions >= 4.0, fix alising violations that this uncovered, gives small speedups for most codecs, FS#10801 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23784 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libspc/spc_dsp.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'apps/codecs/libspc/spc_dsp.c') diff --git a/apps/codecs/libspc/spc_dsp.c b/apps/codecs/libspc/spc_dsp.c index d1facf89a2..9ebd3e6353 100644 --- a/apps/codecs/libspc/spc_dsp.c +++ b/apps/codecs/libspc/spc_dsp.c @@ -77,12 +77,13 @@ static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, /* setup same variables as where decode_brr() is called from */ #undef RAM #define RAM ram.ram + struct src_dir const* const sd = - (struct src_dir*) &RAM [this->r.g.wave_page * 0x100]; + &ram.sd[this->r.g.wave_page * 0x100/sizeof(struct src_dir)]; struct cache_entry_t* const wave_entry = &this->wave_entry [raw_voice->waveform]; - - /* the following block can be put in place of the call to + + /* the following block can be put in place of the call to decode_brr() below */ { @@ -106,7 +107,7 @@ static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, wave_entry->start_addr = start_addr; uint8_t const* const loop_ptr = - RAM + GET_LE16A( sd [raw_voice->waveform].loop ); + RAM + letoh16(sd[raw_voice->waveform].loop); short* loop_start = 0; short* out = BRRcache + start_addr * 2; @@ -251,7 +252,7 @@ static void key_on(struct Spc_Dsp* const this, struct voice_t* const voice, voice->envx = 0; voice->env_mode = state_attack; voice->env_timer = env_rate_init; /* TODO: inaccurate? */ - unsigned start_addr = GET_LE16A(sd [raw_voice->waveform].start); + unsigned start_addr = letoh16(sd[raw_voice->waveform].start); #if !SPC_BRRCACHE { voice->addr = RAM + start_addr; @@ -331,9 +332,9 @@ void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf ) } while ( (vbit >>= 1) != 0 ); } - - struct src_dir const* const sd = - (struct src_dir*) &RAM [this->r.g.wave_page * 0x100]; + + struct src_dir const* const sd = + &ram.sd[this->r.g.wave_page * 0x100/sizeof(struct src_dir)]; #ifdef ROCKBOX_BIG_ENDIAN /* Convert endiannesses before entering loops - these @@ -358,7 +359,7 @@ void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf ) const int echo_start = this->r.g.echo_page * 0x100; #endif /* CPU_COLDFIRE */ #else - #define VOICE_RATE(x) (INT16A(raw_voice->rate) & 0x3FFF) + #define VOICE_RATE(x) (GET_LE16(raw_voice->rate) & 0x3FFF) #define IF_RBE(...) #endif /* ROCKBOX_BIG_ENDIAN */ @@ -590,7 +591,7 @@ void DSP_run_( struct Spc_Dsp* this, long count, int32_t* out_buf ) /* action based on previous block's header */ if ( voice->block_header & 1 ) { - addr = RAM + GET_LE16A( sd [raw_voice->waveform].loop ); + addr = RAM + letoh16(sd[raw_voice->waveform].loop); this->r.g.wave_ended |= vbit; if ( !(voice->block_header & 2) ) /* 1% of the time */ { -- cgit v1.2.3