1
0
Fork 0
forked from len0rd/rockbox

Make local functions static in codecs, where possible.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19612 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Bertrik Sikken 2008-12-29 19:49:48 +00:00
parent 6316e0ff53
commit 8e22f7f5b0
12 changed files with 44 additions and 44 deletions

View file

@ -43,7 +43,7 @@ static inline void output_audio(sample_t *samples)
ci->pcmbuf_insert(&samples[0], &samples[256], 256); ci->pcmbuf_insert(&samples[0], &samples[256], 256);
} }
void a52_decode_data(uint8_t *start, uint8_t *end) static void a52_decode_data(uint8_t *start, uint8_t *end)
{ {
static uint8_t *bufptr = buf; static uint8_t *bufptr = buf;
static uint8_t *bufpos = buf + 7; static uint8_t *bufpos = buf + 7;

View file

@ -57,11 +57,11 @@ static int32_t decoded1[BLOCKS_PER_LOOP] IBSS_ATTR;
skip in that frame. skip in that frame.
*/ */
bool ape_calc_seekpos(struct ape_ctx_t* ape_ctx, static bool ape_calc_seekpos(struct ape_ctx_t* ape_ctx,
uint32_t new_sample, uint32_t new_sample,
uint32_t* newframe, uint32_t* newframe,
uint32_t* filepos, uint32_t* filepos,
uint32_t* samplestoskip) uint32_t* samplestoskip)
{ {
uint32_t n; uint32_t n;
@ -82,9 +82,9 @@ bool ape_calc_seekpos(struct ape_ctx_t* ape_ctx,
/* The resume offset is a value in bytes - we need to /* The resume offset is a value in bytes - we need to
turn it into a frame number and samplestoskip value */ turn it into a frame number and samplestoskip value */
void ape_resume(struct ape_ctx_t* ape_ctx, size_t resume_offset, static void ape_resume(struct ape_ctx_t* ape_ctx, size_t resume_offset,
uint32_t* currentframe, uint32_t* samplesdone, uint32_t* currentframe, uint32_t* samplesdone,
uint32_t* samplestoskip, int* firstbyte) uint32_t* samplestoskip, int* firstbyte)
{ {
off_t newfilepos; off_t newfilepos;
int64_t framesize; int64_t framesize;

View file

@ -2,7 +2,7 @@
libdemac - A Monkey's Audio decoder libdemac - A Monkey's Audio decoder
$Id:$ $Id$
Copyright (C) Dave Chapman 2007 Copyright (C) Dave Chapman 2007
@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#include <inttypes.h> #include <inttypes.h>
static uint32_t crctab32[] = static const uint32_t crctab32[] =
{ {
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,

View file

@ -180,7 +180,7 @@ static bool flac_init(FLACContext* fc, int first_frame_offset)
} }
/* Synchronize to next frame in stream - adapted from libFLAC 1.1.3b2 */ /* Synchronize to next frame in stream - adapted from libFLAC 1.1.3b2 */
bool frame_sync(FLACContext* fc) { static bool frame_sync(FLACContext* fc) {
unsigned int x = 0; unsigned int x = 0;
bool cached = false; bool cached = false;
@ -232,7 +232,7 @@ bool frame_sync(FLACContext* fc) {
} }
/* Seek to sample - adapted from libFLAC 1.1.3b2+ */ /* Seek to sample - adapted from libFLAC 1.1.3b2+ */
bool flac_seek(FLACContext* fc, uint32_t target_sample) { static bool flac_seek(FLACContext* fc, uint32_t target_sample) {
off_t orig_pos = ci->curpos; off_t orig_pos = ci->curpos;
off_t pos = -1; off_t pos = -1;
unsigned long lower_bound, upper_bound; unsigned long lower_bound, upper_bound;
@ -385,7 +385,7 @@ bool flac_seek(FLACContext* fc, uint32_t target_sample) {
} }
/* Seek to file offset */ /* Seek to file offset */
bool flac_seek_offset(FLACContext* fc, uint32_t offset) { static bool flac_seek_offset(FLACContext* fc, uint32_t offset) {
unsigned unparseable_count; unsigned unparseable_count;
bool got_a_frame = false; bool got_a_frame = false;

View file

@ -51,7 +51,7 @@ static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
/* fixed point square root approximation */ /* fixed point square root approximation */
/* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */ /* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */
real_t fp_sqrt(real_t value) static real_t fp_sqrt(real_t value)
{ {
real_t root = 0; real_t root = 0;

View file

@ -83,7 +83,7 @@ static void read_chunk_ftyp(qtmovie_t *qtmovie, size_t chunk_len)
} }
} }
uint32_t mp4ff_read_mp4_descr_length(stream_t* stream) static uint32_t mp4ff_read_mp4_descr_length(stream_t* stream)
{ {
uint8_t b; uint8_t b;
uint8_t numBytes = 0; uint8_t numBytes = 0;

View file

@ -253,7 +253,7 @@ int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd)
// currently implemented) this is calculated from the slow_level values and the // currently implemented) this is calculated from the slow_level values and the
// bitrate accumulators. Note that the bitrate accumulators can be changing. // bitrate accumulators. Note that the bitrate accumulators can be changing.
void update_error_limit (struct words_data *w, uint32_t flags) static void update_error_limit (struct words_data *w, uint32_t flags)
{ {
int bitrate_0 = (w->bitrate_acc [0] += w->bitrate_delta [0]) >> 16; int bitrate_0 = (w->bitrate_acc [0] += w->bitrate_delta [0]) >> 16;

View file

@ -264,27 +264,27 @@ void mixer_playsample(int channel, int instrument)
modplayer.modchannel[channel].instrument = instrument; modplayer.modchannel[channel].instrument = instrument;
} }
inline void mixer_stopsample(int channel) static inline void mixer_stopsample(int channel)
{ {
mixer.channel[channel].channelactive = false; mixer.channel[channel].channelactive = false;
} }
inline void mixer_continuesample(int channel) static inline void mixer_continuesample(int channel)
{ {
mixer.channel[channel].channelactive = true; mixer.channel[channel].channelactive = true;
} }
inline void mixer_setvolume(int channel, int volume) static inline void mixer_setvolume(int channel, int volume)
{ {
mixer.channel[channel].volume = volume; mixer.channel[channel].volume = volume;
} }
inline void mixer_setpanning(int channel, int panning) static inline void mixer_setpanning(int channel, int panning)
{ {
mixer.channel[channel].panning = panning; mixer.channel[channel].panning = panning;
} }
inline void mixer_setamigaperiod(int channel, int amigaperiod) static inline void mixer_setamigaperiod(int channel, int amigaperiod)
{ {
/* Just to make sure we don't devide by zero /* Just to make sure we don't devide by zero
* amigaperiod shouldn't 0 anyway - if it is the case * amigaperiod shouldn't 0 anyway - if it is the case
@ -1090,7 +1090,7 @@ void playeffect(int currenttick)
} }
} }
inline int clip(int i) static inline int clip(int i)
{ {
if (i > 32767) return(32767); if (i > 32767) return(32767);
else if (i < -32768) return(-32768); else if (i < -32768) return(-32768);

View file

@ -1156,7 +1156,7 @@ void putbits(uint32_t val, uint32_t nbit)
/* of the Huffman tables as defined in the IS (Table B.7), and will not */ /* of the Huffman tables as defined in the IS (Table B.7), and will not */
/* work with any arbitrary tables. */ /* work with any arbitrary tables. */
/***************************************************************************/ /***************************************************************************/
int choose_table( short *ix, uint32_t begin, uint32_t end, int *bits ) static int choose_table( short *ix, uint32_t begin, uint32_t end, int *bits )
{ {
uint32_t i; uint32_t i;
int max, table0, table1; int max, table0, table1;
@ -1301,7 +1301,7 @@ int count_bigv(short *ix, uint32_t start, uint32_t end, int table0,
/* Function: Calculation of rzero, count1, address3 */ /* Function: Calculation of rzero, count1, address3 */
/* (Partitions ix into big values, quadruples and zeros). */ /* (Partitions ix into big values, quadruples and zeros). */
/*************************************************************************/ /*************************************************************************/
int calc_runlen( short *ix, side_info_t *si ) static int calc_runlen( short *ix, side_info_t *si )
{ {
int p, i, sum = 0; int p, i, sum = 0;
@ -1347,7 +1347,7 @@ int calc_runlen( short *ix, side_info_t *si )
/*************************************************************************/ /*************************************************************************/
/* Function: Quantization of the vector xr ( -> ix) */ /* Function: Quantization of the vector xr ( -> ix) */
/*************************************************************************/ /*************************************************************************/
int quantize_int(int *xr, short *ix, side_info_t *si) static int quantize_int(int *xr, short *ix, side_info_t *si)
{ {
unsigned int i, idx, s, frac_pow[] = { 0x10000, 0xd745, 0xb505, 0x9838 }; unsigned int i, idx, s, frac_pow[] = { 0x10000, 0xd745, 0xb505, 0x9838 };
@ -1379,7 +1379,7 @@ int quantize_int(int *xr, short *ix, side_info_t *si)
/*************************************************************************/ /*************************************************************************/
/* subdivides the bigvalue region which will use separate Huffman tables */ /* subdivides the bigvalue region which will use separate Huffman tables */
/*************************************************************************/ /*************************************************************************/
void subdivide(side_info_t *si) static void subdivide(side_info_t *si)
{ {
int scfb, count0, count1; int scfb, count0, count1;
@ -1407,7 +1407,7 @@ void subdivide(side_info_t *si)
/*******************************************************************/ /*******************************************************************/
/* Count the number of bits necessary to code the bigvalues region */ /* Count the number of bits necessary to code the bigvalues region */
/*******************************************************************/ /*******************************************************************/
int bigv_bitcount(short *ix, side_info_t *gi) static int bigv_bitcount(short *ix, side_info_t *gi)
{ {
int b1=0, b2=0, b3=0; int b1=0, b2=0, b3=0;
@ -1428,7 +1428,7 @@ int bigv_bitcount(short *ix, side_info_t *gi)
return b1+b2+b3; return b1+b2+b3;
} }
int quantize_and_count_bits(int *xr, short *ix, side_info_t *si) static int quantize_and_count_bits(int *xr, short *ix, side_info_t *si)
{ {
int bits = 10000; int bits = 10000;
@ -1445,7 +1445,7 @@ int quantize_and_count_bits(int *xr, short *ix, side_info_t *si)
/************************************************************************/ /************************************************************************/
/* The code selects the best quantStep for a particular set of scalefacs*/ /* The code selects the best quantStep for a particular set of scalefacs*/
/************************************************************************/ /************************************************************************/
int inner_loop(int *xr, int max_bits, side_info_t *si) static int inner_loop(int *xr, int max_bits, side_info_t *si)
{ {
int bits; int bits;
@ -1469,7 +1469,7 @@ int inner_loop(int *xr, int max_bits, side_info_t *si)
return bits; return bits;
} }
void iteration_loop(int *xr, side_info_t *si, int gr_cnt) static void iteration_loop(int *xr, side_info_t *si, int gr_cnt)
{ {
int remain, tar_bits, max_bits = cfg.mean_bits; int remain, tar_bits, max_bits = cfg.mean_bits;
@ -1971,10 +1971,10 @@ static int find_samplerate_index(long freq, int *mp3_type)
return i; return i;
} }
bool init_mp3_encoder_engine(int sample_rate, static bool init_mp3_encoder_engine(int sample_rate,
int num_channels, int num_channels,
int rec_mono_mode, int rec_mono_mode,
struct encoder_config *enc_cfg) struct encoder_config *enc_cfg)
{ {
const bool stereo = num_channels > 1; const bool stereo = num_channels > 1;
uint32_t avg_byte_per_frame; uint32_t avg_byte_per_frame;
@ -2157,7 +2157,7 @@ static inline void byte_swap_frame32(uint32_t *dst, uint32_t *src,
} /* byte_swap_frame32 */ } /* byte_swap_frame32 */
#endif /* ROCKBOX_LITTLE_ENDIAN */ #endif /* ROCKBOX_LITTLE_ENDIAN */
void set_scale_facs(int *mdct_freq) static void set_scale_facs(int *mdct_freq)
{ {
unsigned int i, is, ie, k, s; unsigned int i, is, ie, k, s;
int max_freq_val, avrg_freq_val; int max_freq_val, avrg_freq_val;

View file

@ -56,7 +56,7 @@ unsigned char mad_main_data[MAD_BUFFER_MDLEN] IBSS_ATTR;
int mpeg_latency[3] = { 0, 481, 529 }; int mpeg_latency[3] = { 0, 481, 529 };
int mpeg_framesize[3] = {384, 1152, 1152}; int mpeg_framesize[3] = {384, 1152, 1152};
void init_mad(void) static void init_mad(void)
{ {
ci->memset(&stream, 0, sizeof(struct mad_stream)); ci->memset(&stream, 0, sizeof(struct mad_stream));
ci->memset(&frame, 0, sizeof(struct mad_frame)); ci->memset(&frame, 0, sizeof(struct mad_frame));
@ -85,7 +85,7 @@ void init_mad(void)
} }
int get_file_pos(int newtime) static int get_file_pos(int newtime)
{ {
int pos = -1; int pos = -1;
struct mp3entry *id3 = ci->id3; struct mp3entry *id3 = ci->id3;

View file

@ -27,14 +27,14 @@ CODEC_HEADER
mpc_decoder decoder IBSS_ATTR; mpc_decoder decoder IBSS_ATTR;
/* Our implementations of the mpc_reader callback functions. */ /* Our implementations of the mpc_reader callback functions. */
mpc_int32_t read_impl(void *data, void *ptr, mpc_int32_t size) static mpc_int32_t read_impl(void *data, void *ptr, mpc_int32_t size)
{ {
struct codec_api *ci = (struct codec_api *)data; struct codec_api *ci = (struct codec_api *)data;
return ((mpc_int32_t)(ci->read_filebuf(ptr, size))); return ((mpc_int32_t)(ci->read_filebuf(ptr, size)));
} }
mpc_bool_t seek_impl(void *data, mpc_int32_t offset) static mpc_bool_t seek_impl(void *data, mpc_int32_t offset)
{ {
struct codec_api *ci = (struct codec_api *)data; struct codec_api *ci = (struct codec_api *)data;
@ -43,21 +43,21 @@ mpc_bool_t seek_impl(void *data, mpc_int32_t offset)
return ci->seek_buffer(offset); return ci->seek_buffer(offset);
} }
mpc_int32_t tell_impl(void *data) static mpc_int32_t tell_impl(void *data)
{ {
struct codec_api *ci = (struct codec_api *)data; struct codec_api *ci = (struct codec_api *)data;
return ci->curpos; return ci->curpos;
} }
mpc_int32_t get_size_impl(void *data) static mpc_int32_t get_size_impl(void *data)
{ {
struct codec_api *ci = (struct codec_api *)data; struct codec_api *ci = (struct codec_api *)data;
return ci->filesize; return ci->filesize;
} }
mpc_bool_t canseek_impl(void *data) static mpc_bool_t canseek_impl(void *data)
{ {
(void)data; (void)data;

View file

@ -4294,7 +4294,7 @@ jammed:
/****************** rockbox interface ******************/ /****************** rockbox interface ******************/
void set_codec_track(int t, int d) { static void set_codec_track(int t, int d) {
int track,fade,def=0; int track,fade,def=0;
SetTrack(t); SetTrack(t);