1
0
Fork 0
forked from len0rd/rockbox

FS#12140 by Sean Bartell, Make various codec stuff static.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29942 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nils Wallménius 2011-06-01 10:28:26 +00:00
parent 05a1984eb3
commit 7c6056b352
14 changed files with 77 additions and 74 deletions

View file

@ -58,7 +58,7 @@ static const char support_formats[9][2] = {
{ AU_FORMAT_ALAW, 8 }, /* 27: G.711 ALAW */ { AU_FORMAT_ALAW, 8 }, /* 27: G.711 ALAW */
}; };
const struct pcm_entry au_codecs[] = { static const struct pcm_entry au_codecs[] = {
{ AU_FORMAT_MULAW, get_itut_g711_mulaw_codec }, { AU_FORMAT_MULAW, get_itut_g711_mulaw_codec },
{ AU_FORMAT_PCM, get_linear_pcm_codec }, { AU_FORMAT_PCM, get_linear_pcm_codec },
{ AU_FORMAT_IEEE_FLOAT, get_ieee_float_codec }, { AU_FORMAT_IEEE_FLOAT, get_ieee_float_codec },

View file

@ -276,8 +276,8 @@ static inline FFTComplex* TRANSFORM_ZERO(FFTComplex * z, unsigned int n)
#endif #endif
/* z[0...8n-1], w[1...2n-1] */ /* z[0...8n-1], w[1...2n-1] */
void pass(FFTComplex *z_arg, unsigned int STEP_arg, unsigned int n_arg) ICODE_ATTR_TREMOR_MDCT; static void pass(FFTComplex *z_arg, unsigned int STEP_arg, unsigned int n_arg) ICODE_ATTR_TREMOR_MDCT;
void pass(FFTComplex *z_arg, unsigned int STEP_arg, unsigned int n_arg) static void pass(FFTComplex *z_arg, unsigned int STEP_arg, unsigned int n_arg)
{ {
register FFTComplex * z = z_arg; register FFTComplex * z = z_arg;
register unsigned int STEP = STEP_arg; register unsigned int STEP = STEP_arg;
@ -318,8 +318,8 @@ void pass(FFTComplex *z_arg, unsigned int STEP_arg, unsigned int n_arg)
8192/16 (from "ff_cos_16") is 512 bytes. 8192/16 (from "ff_cos_16") is 512 bytes.
i.e. for fft16, STEP = 8192/16 */ i.e. for fft16, STEP = 8192/16 */
#define DECL_FFT(n,n2,n4)\ #define DECL_FFT(n,n2,n4)\
void fft##n(FFTComplex *z) ICODE_ATTR_TREMOR_MDCT;\ static void fft##n(FFTComplex *z) ICODE_ATTR_TREMOR_MDCT;\
void fft##n(FFTComplex *z)\ static void fft##n(FFTComplex *z)\
{\ {\
fft##n2(z);\ fft##n2(z);\
fft##n4(z+n4*2);\ fft##n4(z+n4*2);\
@ -379,8 +379,8 @@ static void fft8_dispatch(FFTComplex *z)
} }
#ifndef CONFIG_SMALL #ifndef CONFIG_SMALL
void fft16(FFTComplex *z) ICODE_ATTR_TREMOR_MDCT; static void fft16(FFTComplex *z) ICODE_ATTR_TREMOR_MDCT;
void fft16(FFTComplex *z) static void fft16(FFTComplex *z)
{ {
fft8(z); fft8(z);
fft4(z+8); fft4(z+8);

View file

@ -40,9 +40,9 @@
#define SIGNEXTEND24(val) (((signed)val<<8)>>8) #define SIGNEXTEND24(val) (((signed)val<<8)>>8)
int16_t predictor_coef_table[32] IBSS_ATTR; static int16_t predictor_coef_table[32] IBSS_ATTR;
int16_t predictor_coef_table_a[32] IBSS_ATTR; static int16_t predictor_coef_table_a[32] IBSS_ATTR;
int16_t predictor_coef_table_b[32] IBSS_ATTR; static int16_t predictor_coef_table_b[32] IBSS_ATTR;
/* Endian/aligment safe functions - only used in alac_set_info() */ /* Endian/aligment safe functions - only used in alac_set_info() */
@ -578,16 +578,16 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
} }
} }
void deinterlace_16(int32_t* buffer0, static void deinterlace_16(int32_t* buffer0,
int32_t* buffer1, int32_t* buffer1,
int numsamples, int numsamples,
uint8_t interlacing_shift, uint8_t interlacing_shift,
uint8_t interlacing_leftweight) ICODE_ATTR_ALAC; uint8_t interlacing_leftweight) ICODE_ATTR_ALAC;
void deinterlace_16(int32_t* buffer0, static void deinterlace_16(int32_t* buffer0,
int32_t* buffer1, int32_t* buffer1,
int numsamples, int numsamples,
uint8_t interlacing_shift, uint8_t interlacing_shift,
uint8_t interlacing_leftweight) uint8_t interlacing_leftweight)
{ {
int i; int i;
if (numsamples <= 0) return; if (numsamples <= 0) return;
@ -619,20 +619,20 @@ void deinterlace_16(int32_t* buffer0,
} }
} }
void deinterlace_24(int32_t *buffer0, int32_t *buffer1, static void deinterlace_24(int32_t *buffer0, int32_t *buffer1,
int uncompressed_bytes, int uncompressed_bytes,
int32_t *uncompressed_bytes_buffer0, int32_t *uncompressed_bytes_buffer0,
int32_t *uncompressed_bytes_buffer1, int32_t *uncompressed_bytes_buffer1,
int numsamples, int numsamples,
uint8_t interlacing_shift, uint8_t interlacing_shift,
uint8_t interlacing_leftweight) ICODE_ATTR_ALAC; uint8_t interlacing_leftweight) ICODE_ATTR_ALAC;
void deinterlace_24(int32_t *buffer0, int32_t *buffer1, static void deinterlace_24(int32_t *buffer0, int32_t *buffer1,
int uncompressed_bytes, int uncompressed_bytes,
int32_t *uncompressed_bytes_buffer0, int32_t *uncompressed_bytes_buffer0,
int32_t *uncompressed_bytes_buffer1, int32_t *uncompressed_bytes_buffer1,
int numsamples, int numsamples,
uint8_t interlacing_shift, uint8_t interlacing_shift,
uint8_t interlacing_leftweight) uint8_t interlacing_leftweight)
{ {
int i; int i;
if (numsamples <= 0) return; if (numsamples <= 0) return;

View file

@ -474,8 +474,8 @@ static void inverseQuantizeSpectrum(int *mantissas, int32_t *pOut,
* @return outSubbands subband counter, fix for broken specification/files * @return outSubbands subband counter, fix for broken specification/files
*/ */
int decodeSpectrum (GetBitContext *gb, int32_t *pOut) ICODE_ATTR_LARGE_IRAM; static int decodeSpectrum (GetBitContext *gb, int32_t *pOut) ICODE_ATTR_LARGE_IRAM;
int decodeSpectrum (GetBitContext *gb, int32_t *pOut) static int decodeSpectrum (GetBitContext *gb, int32_t *pOut)
{ {
int numSubbands, codingMode, cnt, first, last, subbWidth; int numSubbands, codingMode, cnt, first, last, subbWidth;
int subband_vlc_index[32], SF_idxs[32]; int subband_vlc_index[32], SF_idxs[32];

View file

@ -118,13 +118,15 @@ enum
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// forward declarations // forward declarations
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void mpc_decoder_requantisierung (mpc_decoder *d) static void mpc_decoder_requantisierung (mpc_decoder *d)
ICODE_ATTR_MPC_LARGE_IRAM; ICODE_ATTR_MPC_LARGE_IRAM;
void mpc_decoder_read_bitstream_sv7(mpc_decoder * d, mpc_bits_reader * r) static void mpc_decoder_read_bitstream_sv7(mpc_decoder * d,
ICODE_ATTR_MPC_LARGE_IRAM; mpc_bits_reader * r)
void mpc_decoder_read_bitstream_sv8(mpc_decoder * d, mpc_bits_reader * r, ICODE_ATTR_MPC_LARGE_IRAM;
mpc_bool_t is_key_frame) static void mpc_decoder_read_bitstream_sv8(mpc_decoder * d,
ICODE_ATTR_MPC_SV8_BS_DEC; mpc_bits_reader * r,
mpc_bool_t is_key_frame)
ICODE_ATTR_MPC_SV8_BS_DEC;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// macros // macros
@ -348,7 +350,7 @@ void mpc_decoder_decode_frame(mpc_decoder * d,
} }
} }
void static void
mpc_decoder_requantisierung(mpc_decoder *d) mpc_decoder_requantisierung(mpc_decoder *d)
{ {
mpc_int32_t Band; mpc_int32_t Band;
@ -431,7 +433,7 @@ mpc_decoder_requantisierung(mpc_decoder *d)
} }
} }
void mpc_decoder_read_bitstream_sv7(mpc_decoder * d, mpc_bits_reader * r) static void mpc_decoder_read_bitstream_sv7(mpc_decoder * d, mpc_bits_reader * r)
{ {
mpc_int32_t n, idx, Max_used_Band = 0; mpc_int32_t n, idx, Max_used_Band = 0;
@ -580,7 +582,7 @@ void mpc_decoder_read_bitstream_sv7(mpc_decoder * d, mpc_bits_reader * r)
} }
} }
void mpc_decoder_read_bitstream_sv8(mpc_decoder * d, mpc_bits_reader * r, mpc_bool_t is_key_frame) static void mpc_decoder_read_bitstream_sv8(mpc_decoder * d, mpc_bits_reader * r, mpc_bool_t is_key_frame)
{ {
mpc_int32_t n, Max_used_Band; mpc_int32_t n, Max_used_Band;
const mpc_can_data * Table, * Tables[2]; const mpc_can_data * Table, * Tables[2];

View file

@ -139,7 +139,9 @@ MPC_API void mpc_decoder_exit(mpc_decoder *p_dec);
* by this factor. Useful for applying replay gain. * by this factor. Useful for applying replay gain.
* @param scale_factor multiplicative scaling factor * @param scale_factor multiplicative scaling factor
*/ */
/* rockbox: changed to static
MPC_API void mpc_decoder_scale_output(mpc_decoder *p_dec, double scale_factor); MPC_API void mpc_decoder_scale_output(mpc_decoder *p_dec, double scale_factor);
*/
MPC_API void mpc_decoder_decode_frame(mpc_decoder * d, mpc_bits_reader * r, mpc_frame_info * i); MPC_API void mpc_decoder_decode_frame(mpc_decoder * d, mpc_bits_reader * r, mpc_frame_info * i);

View file

@ -90,7 +90,7 @@ static mpc_uint32_t find_shift(double fval)
#define SET_SCF(N,X) d->SCF[N] = MAKE_MPC_SAMPLE_EX(X,d->SCF_shift[N] = (mpc_uint8_t) find_shift(X)); #define SET_SCF(N,X) d->SCF[N] = MAKE_MPC_SAMPLE_EX(X,d->SCF_shift[N] = (mpc_uint8_t) find_shift(X));
void static void
mpc_decoder_scale_output(mpc_decoder *d, double factor) mpc_decoder_scale_output(mpc_decoder *d, double factor)
{ {
mpc_int32_t n; double f1, f2; mpc_int32_t n; double f1, f2;

View file

@ -433,14 +433,6 @@ struct Timer
int counter; int counter;
}; };
void Timer_run_( struct Timer* t, long time ) ICODE_ATTR_SPC;
static inline void Timer_run( struct Timer* t, long time )
{
if ( time >= t->next_tick )
Timer_run_( t, time );
}
struct Spc_Emu struct Spc_Emu
{ {
uint8_t cycle_table [0x100]; uint8_t cycle_table [0x100];
@ -490,14 +482,6 @@ static inline int DSP_read( struct Spc_Dsp* this, int i )
return this->r.reg [i]; return this->r.reg [i];
} }
void SPC_run_dsp_( THIS, long time ) ICODE_ATTR_SPC;
static inline void SPC_run_dsp( THIS, long time )
{
if ( time >= this->next_dsp )
SPC_run_dsp_( this, time );
}
int SPC_read( THIS, unsigned addr, long const time ) ICODE_ATTR_SPC; int SPC_read( THIS, unsigned addr, long const time ) ICODE_ATTR_SPC;
void SPC_write( THIS, unsigned addr, int data, long const time ) ICODE_ATTR_SPC; void SPC_write( THIS, unsigned addr, int data, long const time ) ICODE_ATTR_SPC;

View file

@ -32,7 +32,8 @@ struct cpu_ram_t ram IBSS_ATTR_SPC_LARGE_IRAM CACHEALIGN_ATTR;
/**************** Timers ****************/ /**************** Timers ****************/
void Timer_run_( struct Timer* t, long time ) static void Timer_run_( struct Timer* t, long time ) ICODE_ATTR_SPC;
static void Timer_run_( struct Timer* t, long time )
{ {
/* when disabled, next_tick should always be in the future */ /* when disabled, next_tick should always be in the future */
assert( t->enabled ); assert( t->enabled );
@ -50,6 +51,12 @@ void Timer_run_( struct Timer* t, long time )
t->count = elapsed; t->count = elapsed;
} }
static inline void Timer_run( struct Timer* t, long time )
{
if ( time >= t->next_tick )
Timer_run_( t, time );
}
/**************** SPC emulator ****************/ /**************** SPC emulator ****************/
/* 1.024 MHz clock / 32000 samples per second */ /* 1.024 MHz clock / 32000 samples per second */
@ -179,7 +186,8 @@ int SPC_load_spc( THIS, const void* data, long size )
} }
/**************** DSP interaction ****************/ /**************** DSP interaction ****************/
void SPC_run_dsp_( THIS, long time ) static void SPC_run_dsp_( THIS, long time ) ICODE_ATTR_SPC;
static void SPC_run_dsp_( THIS, long time )
{ {
/* divide by CLOCKS_PER_SAMPLE */ /* divide by CLOCKS_PER_SAMPLE */
int count = ((time - this->next_dsp) >> 5) + 1; int count = ((time - this->next_dsp) >> 5) + 1;
@ -189,6 +197,12 @@ void SPC_run_dsp_( THIS, long time )
DSP_run( &this->dsp, count, buf ); DSP_run( &this->dsp, count, buf );
} }
static inline void SPC_run_dsp( THIS, long time )
{
if ( time >= this->next_dsp )
SPC_run_dsp_( this, time );
}
int SPC_read( THIS, unsigned addr, long const time ) int SPC_read( THIS, unsigned addr, long const time )
{ {
int result = RAM [addr]; int result = RAM [addr];

View file

@ -289,11 +289,11 @@ static int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
} }
/* duplicate code here as speed is somewhat more important */ /* duplicate code here as speed is somewhat more important */
int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl, static int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
ogg_int32_t **in,int *nonzero,int ch) ogg_int32_t **in,int *nonzero,int ch)
ICODE_ATTR_TREMOR_NOT_MDCT; ICODE_ATTR_TREMOR_NOT_MDCT;
int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl, static int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
ogg_int32_t **in,int *nonzero,int ch){ ogg_int32_t **in,int *nonzero,int ch){
long i,k,l,s; long i,k,l,s;
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
vorbis_info_residue0 *info=look->info; vorbis_info_residue0 *info=look->info;

View file

@ -53,7 +53,7 @@ static decoder tta[MAX_NCH] IBSS_ATTR; /* decoder state */
/* Rockbox speciffic: cache is defined in get_samples() (non static value) */ /* Rockbox speciffic: cache is defined in get_samples() (non static value) */
/* static int cache[MAX_NCH]; // decoder cache */ /* static int cache[MAX_NCH]; // decoder cache */
tta_info *ttainfo IBSS_ATTR; /* currently playing file info */ static tta_info *ttainfo IBSS_ATTR; /* currently playing file info */
static unsigned int fframes IBSS_ATTR; /* number of frames in file */ static unsigned int fframes IBSS_ATTR; /* number of frames in file */
static unsigned int framelen IBSS_ATTR; /* the frame length in samples */ static unsigned int framelen IBSS_ATTR; /* the frame length in samples */

View file

@ -34,7 +34,7 @@ CODEC_HEADER
/**************** ID666 parsing ****************/ /**************** ID666 parsing ****************/
struct { static struct {
unsigned char isBinary; unsigned char isBinary;
char song[32]; char song[32];
char game[32]; char game[32];
@ -397,7 +397,7 @@ static inline void spc_play_send_samples(int32_t *samples)
#else /* !SPC_DUAL_CORE */ #else /* !SPC_DUAL_CORE */
/** Implementations for single-core operation **/ /** Implementations for single-core operation **/
int32_t wav_chunk[WAV_CHUNK_SIZE*2] IBSS_ATTR; static int32_t wav_chunk[WAV_CHUNK_SIZE*2] IBSS_ATTR;
/* load a new program into emu */ /* load a new program into emu */
static inline int load_spc_buffer(uint8_t *buf, size_t size) static inline int load_spc_buffer(uint8_t *buf, size_t size)

View file

@ -60,7 +60,7 @@ enum
WAVE_FORMAT_EXTENSIBLE = 0xFFFE WAVE_FORMAT_EXTENSIBLE = 0xFFFE
}; };
const struct pcm_entry wave_codecs[] = { static const struct pcm_entry wave_codecs[] = {
{ WAVE_FORMAT_UNKNOWN, 0 }, { WAVE_FORMAT_UNKNOWN, 0 },
{ WAVE_FORMAT_PCM, get_linear_pcm_codec }, { WAVE_FORMAT_PCM, get_linear_pcm_codec },
{ WAVE_FORMAT_ADPCM, get_ms_adpcm_codec }, { WAVE_FORMAT_ADPCM, get_ms_adpcm_codec },

View file

@ -25,7 +25,8 @@
CODEC_HEADER CODEC_HEADER
int32_t *dec[2]; /* pointers to the output buffers in WMAProDecodeCtx in wmaprodec.c */ static int32_t *dec[2]; /* pointers to the output buffers in WMAProDecodeCtx in
wmaprodec.c */
/* this is the codec entry point */ /* this is the codec entry point */