From 87021f7c0ac4620eafd185ff11905ee643f72b6c Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 18 May 2013 01:45:03 -0400 Subject: SPC Codec: Refactor for CPU and clean up some things. CPU optimization gets its own files in which to fill-in optimizable routines. Some pointless #if 0's for profiling need removal. Those macros are empty if not profiling. Force some functions that are undesirable to be force-inlined by the compiler to be not inlined. Change-Id: Ia7b7e45380d7efb20c9b1a4d52e05db3ef6bbaab --- lib/rbcodec/codecs/libspc/spc_emu.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'lib/rbcodec/codecs/libspc/spc_emu.c') diff --git a/lib/rbcodec/codecs/libspc/spc_emu.c b/lib/rbcodec/codecs/libspc/spc_emu.c index 5ea5b0cdeb..dab4199ef0 100644 --- a/lib/rbcodec/codecs/libspc/spc_emu.c +++ b/lib/rbcodec/codecs/libspc/spc_emu.c @@ -32,8 +32,8 @@ struct cpu_ram_t ram IBSS_ATTR_SPC_LARGE_IRAM CACHEALIGN_ATTR; /**************** Timers ****************/ -static void Timer_run_( struct Timer* t, long time ) ICODE_ATTR_SPC; -static void Timer_run_( struct Timer* t, long time ) +static void NO_INLINE ICODE_ATTR_SPC +Timer_run_( struct Timer* t, long time ) { /* when disabled, next_tick should always be in the future */ assert( t->enabled ); @@ -60,7 +60,7 @@ static inline void Timer_run( struct Timer* t, long time ) /**************** SPC emulator ****************/ /* 1.024 MHz clock / 32000 samples per second */ -static void SPC_enable_rom( THIS, int enable ) +static void NO_INLINE SPC_enable_rom( THIS, int enable ) { if ( this->rom_enabled != enable ) { @@ -186,8 +186,8 @@ int SPC_load_spc( THIS, const void* data, long size ) } /**************** DSP interaction ****************/ -static void SPC_run_dsp_( THIS, long time ) ICODE_ATTR_SPC; -static void SPC_run_dsp_( THIS, long time ) +static void NO_INLINE ICODE_ATTR_SPC +SPC_run_dsp_( THIS, long time ) { /* divide by CLOCKS_PER_SAMPLE */ int count = ((time - this->next_dsp) >> 5) + 1; @@ -383,13 +383,10 @@ int SPC_play( THIS, long count, int32_t* out ) } /* Catch DSP up to present */ -#if 0 ENTER_TIMER(cpu); -#endif SPC_run_dsp( this, -EXTRA_CLOCKS ); -#if 0 EXIT_TIMER(cpu); -#endif + assert( this->next_dsp == CLOCKS_PER_SAMPLE - EXTRA_CLOCKS ); assert( this->sample_buf - out == count ); -- cgit v1.2.3