From 80da8b141c4672ca4380d66094976b6342ed5071 Mon Sep 17 00:00:00 2001 From: Tomasz Malesinski Date: Sun, 26 Nov 2006 18:31:41 +0000 Subject: FS#6357, patch 1: let iramcopy and bss share the same space in codecs and plugins. Currently, in case of plugins using IRAM bss is cleared twice, once in the loader, once in PLUGIN_IRAM_INIT. For codecs, bss is cleared only during codec initialization. Also, removed double variables in codecs storing a pointer to codec_api. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11606 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/Makefile | 16 ++++---- apps/codecs/a52.c | 21 +--------- apps/codecs/aac.c | 35 ++++------------- apps/codecs/adx.c | 10 +---- apps/codecs/aiff.c | 23 +---------- apps/codecs/aiff_enc.c | 18 +-------- apps/codecs/alac.c | 37 +++++------------- apps/codecs/codec.h | 2 + apps/codecs/codec_crt0.c | 46 ++++++++++++++++++++++ apps/codecs/flac.c | 23 +---------- apps/codecs/lib/codeclib.c | 45 ++++++++++----------- apps/codecs/lib/codeclib.h | 3 +- apps/codecs/mp3_enc.c | 18 +-------- apps/codecs/mpa.c | 21 +--------- apps/codecs/mpc.c | 18 +-------- apps/codecs/shorten.c | 27 ++----------- apps/codecs/sid.c | 27 ++----------- apps/codecs/vorbis.c | 97 +++++++++++++++++++--------------------------- apps/codecs/wav.c | 23 +---------- apps/codecs/wav_enc.c | 18 +-------- apps/codecs/wavpack.c | 21 +--------- apps/codecs/wavpack_enc.c | 18 +-------- 22 files changed, 163 insertions(+), 404 deletions(-) create mode 100644 apps/codecs/codec_crt0.c (limited to 'apps/codecs') diff --git a/apps/codecs/Makefile b/apps/codecs/Makefile index 38723b7..e964bf7 100644 --- a/apps/codecs/Makefile +++ b/apps/codecs/Makefile @@ -66,7 +66,7 @@ $(OBJDIR)/mp3_enc.elf: $(OBJDIR)/mp3_enc.o $(OBJDIR)/wav_enc.elf: $(OBJDIR)/wav_enc.o $(OBJDIR)/wavpack_enc.elf: $(OBJDIR)/wavpack_enc.o $(BUILDDIR)/libwavpack.a -$(OBJDIR)/%.elf: +$(OBJDIR)/%.elf: $(OBJDIR)/codec_crt0.o $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -O -nostdlib -o $@ $^ -L$(BUILDDIR) -lcodec -lgcc -T$(LINKCODEC) -Wl,-Map,$(OBJDIR)/$*.map $(OBJDIR)/%.codec : $(OBJDIR)/%.elf @@ -77,8 +77,8 @@ ifeq ($(SIMVER), x11) ################################################### # This is the X11 simulator version -$(OBJDIR)/%.codec : $(OBJDIR)/%.o $(BUILDDIR)/libcodec.a $(OUTPUT) - $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $< -L$(BUILDDIR) $(CODECLIBS) -lcodec -o $@ +$(OBJDIR)/%.codec : $(OBJDIR)/%.o $(OBJDIR)/codec_crt0.o $(BUILDDIR)/libcodec.a $(OUTPUT) + $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $< $(OBJDIR)/codec_crt0.o -L$(BUILDDIR) $(CODECLIBS) -lcodec -o $@ ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN) # 'x' must be kept or you'll have "Win32 error 5" # $ fgrep 5 /usr/include/w32api/winerror.h | head -1 @@ -92,8 +92,8 @@ ifeq ($(SIMVER), sdl) ################################################### # This is the SDL simulator version -$(OBJDIR)/%.codec : $(OBJDIR)/%.o $(BUILDDIR)/libcodec.a $(OUTPUT) - $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $< -L$(BUILDDIR) $(CODECLIBS) -lcodec -o $@ +$(OBJDIR)/%.codec : $(OBJDIR)/%.o $(OBJDIR)/codec_crt0.o $(BUILDDIR)/libcodec.a $(OUTPUT) + $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $< $(OBJDIR)/codec_crt0.o -L$(BUILDDIR) $(CODECLIBS) -lcodec -o $@ ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN) # 'x' must be kept or you'll have "Win32 error 5" # $ fgrep 5 /usr/include/w32api/winerror.h | head -1 @@ -108,9 +108,9 @@ else # end of sdl-simulator DLLTOOLFLAGS = --export-all DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin -$(OBJDIR)/%.codec : $(OBJDIR)/%.o $(BUILDDIR)/libcodec.a $(OUTPUT) - $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< - $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< \ +$(OBJDIR)/%.codec : $(OBJDIR)/%.o $(OBJDIR)/codec_crt0.o $(BUILDDIR)/libcodec.a $(OUTPUT) + $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< $(OBJDIR)/codec_crt0.o + $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(OBJDIR)/codec_crt0.o\ $(BUILDDIR)/libcodec.a $(patsubst -l%,$(BUILDDIR)/lib%.a,$(CODECLIBS)) \ -o $@ ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN) diff --git a/apps/codecs/a52.c b/apps/codecs/a52.c index b7190be..4f41bfe 100644 --- a/apps/codecs/a52.c +++ b/apps/codecs/a52.c @@ -28,8 +28,6 @@ CODEC_HEADER #define A52_SAMPLESPERFRAME (6*256) -struct codec_api *ci; - static a52_state_t *state; unsigned long samplesdone; unsigned long frequency; @@ -117,16 +115,8 @@ void a52_decode_data(uint8_t *start, uint8_t *end) } } -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api *api) +enum codec_status codec_main(void) { size_t n; unsigned char *filebuf; @@ -134,19 +124,12 @@ enum codec_status codec_start(struct codec_api *api) int retval; /* Generic codec initialisation */ - ci = api; - - #ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); - #endif - ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_NONINTERLEAVED); ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(1024*128)); next_track: - if (codec_init(api)) { + if (codec_init()) { retval = CODEC_ERROR; goto exit; } diff --git a/apps/codecs/aac.c b/apps/codecs/aac.c index 3c9a637..4a9c747 100644 --- a/apps/codecs/aac.c +++ b/apps/codecs/aac.c @@ -25,19 +25,8 @@ CODEC_HEADER -#ifndef SIMULATOR -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - -struct codec_api* rb; -struct codec_api* ci; - /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api* api) +enum codec_status codec_main(void) { /* Note that when dealing with QuickTime/MPEG4 files, terminology is * a bit confusing. Files with sound are split up in chunks, where @@ -62,14 +51,6 @@ enum codec_status codec_start(struct codec_api* api) unsigned char c = 0; /* Generic codec initialisation */ - rb = api; - ci = api; - -#ifndef SIMULATOR - ci->memcpy(iramstart, iramcopy, iramend-iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*16)); ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); @@ -79,7 +60,7 @@ enum codec_status codec_start(struct codec_api* api) next_track: err = CODEC_OK; - if (codec_init(api)) { + if (codec_init()) { LOGF("FAAD: Codec init error\n"); err = CODEC_ERROR; goto exit; @@ -90,8 +71,8 @@ next_track: sound_samples_done = ci->id3->offset; - ci->configure(DSP_SWITCH_FREQUENCY, (long *)(rb->id3->frequency)); - codec_set_replaygain(rb->id3); + ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency)); + codec_set_replaygain(ci->id3); stream_create(&input_stream,ci); @@ -139,7 +120,7 @@ next_track: /* The main decoding loop */ while (i < demux_res.num_sample_byte_sizes) { - rb->yield(); + ci->yield(); if (ci->stop_codec || ci->new_track) { break; @@ -195,12 +176,12 @@ next_track: ci->advance_buffer(n); /* Output the audio */ - rb->yield(); - while (!rb->pcmbuf_insert_split(decoder->time_out[0], + ci->yield(); + while (!ci->pcmbuf_insert_split(decoder->time_out[0], decoder->time_out[1], frame_info.samples * 2)) { - rb->sleep(1); + ci->sleep(1); } /* Update the elapsed-time indicator */ diff --git a/apps/codecs/adx.c b/apps/codecs/adx.c index 803600b..608d9f0 100644 --- a/apps/codecs/adx.c +++ b/apps/codecs/adx.c @@ -21,8 +21,6 @@ CODEC_HEADER -struct codec_api *rb; - /* Maximum number of bytes to process in one iteration */ #define WAV_CHUNK_SIZE (1024*2) @@ -38,9 +36,8 @@ struct codec_api *rb; static int16_t samples[WAV_CHUNK_SIZE] IBSS_ATTR; /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api *api) +enum codec_status codec_main(void) { - struct codec_api *ci; int channels; int sampleswritten, i; uint8_t *buf; @@ -56,16 +53,13 @@ enum codec_status codec_start(struct codec_api *api) off_t chanstart, bufoff; /* Generic codec initialisation */ - rb = api; - ci = api; - /* we only render 16 bits */ ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)16); /*ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));*/ next_track: DEBUGF("ADX: next_track\n"); - if (codec_init(api)) { + if (codec_init()) { return CODEC_ERROR; } DEBUGF("ADX: after init\n"); diff --git a/apps/codecs/aiff.c b/apps/codecs/aiff.c index 479d405..d1bb14a 100644 --- a/apps/codecs/aiff.c +++ b/apps/codecs/aiff.c @@ -25,8 +25,6 @@ CODEC_HEADER /* Macro that sign extends an unsigned byte */ #define SE(x) ((int32_t)((int8_t)(x))) -struct codec_api *rb; - /* This codec supports AIFF files with the following formats: * - PCM, 8, 16 and 24 bits, mono or stereo */ @@ -43,19 +41,10 @@ enum /* for 44.1kHz stereo 16bits, this represents 0.023s ~= 1/50s */ #define AIF_CHUNK_SIZE (1024*2) -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - static int32_t samples[AIF_CHUNK_SIZE] IBSS_ATTR; -enum codec_status codec_start(struct codec_api *api) +enum codec_status codec_main(void) { - struct codec_api *ci; uint32_t numbytes, bytesdone; uint16_t num_channels = 0; uint32_t num_sample_frames = 0; @@ -73,20 +62,12 @@ enum codec_status codec_start(struct codec_api *api) off_t firstblockposn; /* position of the first block in file */ /* Generic codec initialisation */ - rb = api; - ci = api; - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28); ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256)); next_track: - if (codec_init(api)) { + if (codec_init()) { i = CODEC_ERROR; goto exit; } diff --git a/apps/codecs/aiff_enc.c b/apps/codecs/aiff_enc.c index 8b6e221..4f9e0e0 100644 --- a/apps/codecs/aiff_enc.c +++ b/apps/codecs/aiff_enc.c @@ -24,14 +24,6 @@ CODEC_ENC_HEADER -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - struct aiff_header { uint8_t form_id[4]; /* 00h - 'FORM' */ @@ -77,7 +69,6 @@ struct aiff_header aiff_header = /* (*) updated when finalizing file */ -static struct codec_api *ci; static int num_channels; uint32_t sample_rate; uint32_t enc_size; @@ -332,17 +323,10 @@ static bool init_encoder(void) } /* init_encoder */ /* main codec entry point */ -enum codec_status codec_start(struct codec_api* api) +enum codec_status codec_start(void) { bool cpu_boosted; - ci = api; /* copy to global api pointer */ - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - if (!init_encoder()) { ci->enc_codec_loaded = -1; diff --git a/apps/codecs/alac.c b/apps/codecs/alac.c index 13423f4..1c1b14a 100644 --- a/apps/codecs/alac.c +++ b/apps/codecs/alac.c @@ -23,21 +23,10 @@ CODEC_HEADER -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - int32_t outputbuffer[ALAC_MAX_CHANNELS][ALAC_BLOCKSIZE] IBSS_ATTR; -struct codec_api* rb; -struct codec_api* ci; - /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api* api) +enum codec_status codec_main(void) { size_t n; demux_res_t demux_res; @@ -53,14 +42,6 @@ enum codec_status codec_start(struct codec_api* api) int retval; /* Generic codec initialisation */ - rb = api; - ci = api; - -#ifdef USE_IRAM - rb->memcpy(iramstart, iramcopy, iramend-iramstart); - rb->memset(iedata, 0, iend - iedata); -#endif - ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*128)); @@ -69,7 +50,7 @@ enum codec_status codec_start(struct codec_api* api) next_track: - if (codec_init(api)) { + if (codec_init()) { LOGF("ALAC: Error initialising codec\n"); retval = CODEC_ERROR; goto exit; @@ -78,8 +59,8 @@ enum codec_status codec_start(struct codec_api* api) while (!*ci->taginfo_ready && !ci->stop_codec) ci->sleep(1); - ci->configure(DSP_SWITCH_FREQUENCY, (long *)(rb->id3->frequency)); - codec_set_replaygain(rb->id3); + ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency)); + codec_set_replaygain(ci->id3); stream_create(&input_stream,ci); @@ -99,7 +80,7 @@ enum codec_status codec_start(struct codec_api* api) samplesdone=0; /* The main decoding loop */ while (i < demux_res.num_sample_byte_sizes) { - rb->yield(); + ci->yield(); if (ci->stop_codec || ci->new_track) { break; } @@ -132,18 +113,18 @@ enum codec_status codec_start(struct codec_api* api) } /* Decode one block - returned samples will be host-endian */ - rb->yield(); - samplesdecoded=alac_decode_frame(&alac, buffer, outputbuffer, rb->yield); + ci->yield(); + samplesdecoded=alac_decode_frame(&alac, buffer, outputbuffer, ci->yield); /* Advance codec buffer n bytes */ ci->advance_buffer(n); /* Output the audio */ - rb->yield(); + ci->yield(); while(!ci->pcmbuf_insert_split(outputbuffer[0], outputbuffer[1], samplesdecoded*sizeof(int32_t))) - rb->yield(); + ci->yield(); /* Update the elapsed-time indicator */ samplesdone+=sample_duration; diff --git a/apps/codecs/codec.h b/apps/codecs/codec.h index daa7c19..44d5a11 100644 --- a/apps/codecs/codec.h +++ b/apps/codecs/codec.h @@ -24,6 +24,8 @@ #include +extern struct codec_api *ci; + /* Get these functions 'out of the way' of the standard functions. Not doing * so confuses the cygwin linker, and maybe others. These functions need to * be implemented elsewhere */ diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c new file mode 100644 index 0000000..96dc862 --- /dev/null +++ b/apps/codecs/codec_crt0.c @@ -0,0 +1,46 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 Tomasz Malesinski + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include "codeclib.h" + +struct codec_api *ci; + +extern unsigned char iramcopy[]; +extern unsigned char iramstart[]; +extern unsigned char iramend[]; +extern unsigned char iedata[]; +extern unsigned char iend[]; +extern unsigned char plugin_bss_start[]; +extern unsigned char plugin_end_addr[]; + +extern enum codec_status codec_main(void); + +enum codec_status codec_start(struct codec_api *api) +{ +#ifndef SIMULATOR +#ifdef USE_IRAM + api->memcpy(iramstart, iramcopy, iramend - iramstart); + api->memset(iedata, 0, iend - iedata); +#endif + api->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); +#endif + ci = api; + return codec_main(); +} diff --git a/apps/codecs/flac.c b/apps/codecs/flac.c index 4f5f0b1..b3cba32 100644 --- a/apps/codecs/flac.c +++ b/apps/codecs/flac.c @@ -22,17 +22,6 @@ CODEC_HEADER -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - -struct codec_api* rb; -struct codec_api* ci; - /* The output buffers containing the decoded samples (channels 0 and 1) */ int32_t decoded0[MAX_BLOCKSIZE] IBSS_ATTR_FLAC_DECODED0; int32_t decoded1[MAX_BLOCKSIZE] IBSS_ATTR; @@ -423,7 +412,7 @@ bool flac_seek_offset(FLACContext* fc, uint32_t offset) { } /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api* api) +enum codec_status codec_main(void) { int8_t *buf; FLACContext fc; @@ -436,14 +425,6 @@ enum codec_status codec_start(struct codec_api* api) int retval; /* Generic codec initialisation */ - rb = api; - ci = api; - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend-iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*128)); @@ -455,7 +436,7 @@ enum codec_status codec_start(struct codec_api* api) /* Need to save offset for later use (cleared indirectly by flac_init) */ samplesdone=ci->id3->offset; - if (codec_init(api)) { + if (codec_init()) { LOGF("FLAC: Error initialising codec\n"); retval = CODEC_ERROR; goto exit; diff --git a/apps/codecs/lib/codeclib.c b/apps/codecs/lib/codeclib.c index 4aa7d29..f6b2131 100644 --- a/apps/codecs/lib/codeclib.c +++ b/apps/codecs/lib/codeclib.c @@ -24,29 +24,26 @@ #include "codeclib.h" #include "id3.h" -struct codec_api *local_rb; - long mem_ptr; long bufsize; unsigned char* mp3buf; // The actual MP3 buffer from Rockbox unsigned char* mallocbuf; // 512K from the start of MP3 buffer unsigned char* filebuf; // The rest of the MP3 buffer -int codec_init(struct codec_api* rb) +int codec_init(void) { - local_rb = rb; mem_ptr = 0; - mallocbuf = (unsigned char *)rb->get_codec_memory((size_t *)&bufsize); + mallocbuf = (unsigned char *)ci->get_codec_memory((size_t *)&bufsize); return 0; } void codec_set_replaygain(struct mp3entry* id3) { - local_rb->configure(DSP_SET_TRACK_GAIN, (long *) id3->track_gain); - local_rb->configure(DSP_SET_ALBUM_GAIN, (long *) id3->album_gain); - local_rb->configure(DSP_SET_TRACK_PEAK, (long *) id3->track_peak); - local_rb->configure(DSP_SET_ALBUM_PEAK, (long *) id3->album_peak); + ci->configure(DSP_SET_TRACK_GAIN, (long *) id3->track_gain); + ci->configure(DSP_SET_ALBUM_GAIN, (long *) id3->album_gain); + ci->configure(DSP_SET_TRACK_PEAK, (long *) id3->track_peak); + ci->configure(DSP_SET_ALBUM_PEAK, (long *) id3->album_peak); } /* Various "helper functions" common to all the xxx2wav decoder plugins */ @@ -71,7 +68,7 @@ void* codec_calloc(size_t nmemb, size_t size) x = codec_malloc(nmemb*size); if (x == NULL) return NULL; - local_rb->memset(x,0,nmemb*size); + ci->memset(x,0,nmemb*size); return(x); } @@ -89,71 +86,71 @@ void* codec_realloc(void* ptr, size_t size) size_t strlen(const char *s) { - return(local_rb->strlen(s)); + return(ci->strlen(s)); } char *strcpy(char *dest, const char *src) { - return(local_rb->strcpy(dest,src)); + return(ci->strcpy(dest,src)); } char *strcat(char *dest, const char *src) { - return(local_rb->strcat(dest,src)); + return(ci->strcat(dest,src)); } int strcmp(const char *s1, const char *s2) { - return(local_rb->strcmp(s1,s2)); + return(ci->strcmp(s1,s2)); } int strncasecmp(const char *s1, const char *s2, size_t n) { - return(local_rb->strncasecmp(s1,s2,n)); + return(ci->strncasecmp(s1,s2,n)); } void *memcpy(void *dest, const void *src, size_t n) { - return(local_rb->memcpy(dest,src,n)); + return(ci->memcpy(dest,src,n)); } void *memset(void *s, int c, size_t n) { - return(local_rb->memset(s,c,n)); + return(ci->memset(s,c,n)); } int memcmp(const void *s1, const void *s2, size_t n) { - return(local_rb->memcmp(s1,s2,n)); + return(ci->memcmp(s1,s2,n)); } void* memchr(const void *s, int c, size_t n) { - return(local_rb->memchr(s,c,n)); + return(ci->memchr(s,c,n)); } void *memmove(void *dest, const void *src, size_t n) { - return(local_rb->memmove(dest,src,n)); + return(ci->memmove(dest,src,n)); } void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) { - local_rb->qsort(base,nmemb,size,compar); + ci->qsort(base,nmemb,size,compar); } #ifdef RB_PROFILE void __cyg_profile_func_enter(void *this_fn, void *call_site) { #ifdef CPU_COLDFIRE (void)call_site; - local_rb->profile_func_enter(this_fn, __builtin_return_address(1)); + ci->profile_func_enter(this_fn, __builtin_return_address(1)); #else - local_rb->profile_func_enter(this_fn, call_site); + ci->profile_func_enter(this_fn, call_site); #endif } void __cyg_profile_func_exit(void *this_fn, void *call_site) { - local_rb->profile_func_exit(this_fn,call_site); + ci->profile_func_exit(this_fn,call_site); } #endif diff --git a/apps/codecs/lib/codeclib.h b/apps/codecs/lib/codeclib.h index 00b60c3..366d30e 100644 --- a/apps/codecs/lib/codeclib.h +++ b/apps/codecs/lib/codeclib.h @@ -24,6 +24,7 @@ #define MALLOC_BUFSIZE (512*1024) +extern struct codec_api *ci; extern long mem_ptr; extern long bufsize; extern unsigned char* mp3buf; // The actual MP3 buffer from Rockbox @@ -55,7 +56,7 @@ void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, con /* Various codec helper functions */ -int codec_init(struct codec_api* rb); +int codec_init(void); void codec_set_replaygain(struct mp3entry* id3); #ifdef RB_PROFILE diff --git a/apps/codecs/mp3_enc.c b/apps/codecs/mp3_enc.c index cb727ce..12a24a7 100644 --- a/apps/codecs/mp3_enc.c +++ b/apps/codecs/mp3_enc.c @@ -53,14 +53,6 @@ CODEC_ENC_HEADER #define putlong(c, s) if(s+sz <= 32) { cc = (cc << s) | c; sz+= s; } \ else { putbits(cc, sz); cc = c; sz = s; } -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - typedef struct { int type; /* 0=(MPEG2 - 22.05,24,16kHz) 1=(MPEG1 - 44.1,48,32kHz) */ int mode; /* 0=stereo, 1=jstereo, 2=dual, 3=mono */ @@ -181,7 +173,6 @@ static unsigned pcm_chunk_size IBSS_ATTR; static unsigned samp_per_frame IBSS_ATTR; static config_t cfg IBSS_ATTR; -static struct codec_api *ci; static char *res_buffer; static const uint8_t ht_count_const[2][2][16] = @@ -2460,18 +2451,11 @@ static bool enc_init(void) return true; } /* enc_init */ -enum codec_status codec_start(struct codec_api* api) +enum codec_status codec_main(void) { bool cpu_boosted; /* Generic codec initialisation */ - ci = api; - -#ifdef USE_IRAM - memcpy(iramstart, iramcopy, iramend - iramstart); - memset(iedata, 0, iend - iedata); -#endif - if (!enc_init()) { ci->enc_codec_loaded = -1; diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c index 94947a9..6e474c1 100644 --- a/apps/codecs/mpa.c +++ b/apps/codecs/mpa.c @@ -42,16 +42,6 @@ unsigned char mad_main_data[MAD_BUFFER_MDLEN] IBSS_ATTR; int mpeg_latency[3] = { 0, 481, 529 }; int mpeg_framesize[3] = {384, 1152, 1152}; -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - -struct codec_api *ci; - void init_mad(void) { ci->memset(&stream, 0, sizeof(struct mad_stream)); @@ -69,7 +59,7 @@ void init_mad(void) } /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api *api) +enum codec_status codec_main(void) { int status; size_t size; @@ -83,14 +73,7 @@ enum codec_status codec_start(struct codec_api *api) int framelength; int padding = MAD_BUFFER_GUARD; /* to help mad decode the last frame */ - ci = api; - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - - if (codec_init(api)) + if (codec_init()) return CODEC_ERROR; /* Create a decoder instance */ diff --git a/apps/codecs/mpc.c b/apps/codecs/mpc.c index ad38185..1075d88 100644 --- a/apps/codecs/mpc.c +++ b/apps/codecs/mpc.c @@ -67,18 +67,9 @@ MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH] IBSS_ATTR_MPC_SAMPLE_BUF; mpc_uint32_t seek_table[10000]; -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api *api) +enum codec_status codec_main(void) { - struct codec_api *ci = api; mpc_int64_t samplesdone; unsigned long frequency; unsigned status; @@ -86,11 +77,6 @@ enum codec_status codec_start(struct codec_api *api) mpc_streaminfo info; int retval = CODEC_OK; - #ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); - #endif - ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)(28)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(1024*16)); ci->configure(CODEC_SET_FILEBUF_PRESEEK, (long *)(0)); @@ -109,7 +95,7 @@ enum codec_status codec_start(struct codec_api *api) mpc_decoder_set_seek_table(&decoder, seek_table, sizeof(seek_table)); next_track: - if (codec_init(api)) { + if (codec_init()) { retval = CODEC_ERROR; goto exit; } diff --git a/apps/codecs/shorten.c b/apps/codecs/shorten.c index b48a91e..1b9563a 100644 --- a/apps/codecs/shorten.c +++ b/apps/codecs/shorten.c @@ -20,23 +20,12 @@ #include "codeclib.h" #include -#ifndef IBSS_ATTR_SHORTEN_DECODED0 -#define IBSS_ATTR_SHORTEN_DECODED0 IBSS_ATTR -#endif - CODEC_HEADER -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; +#ifndef IBSS_ATTR_SHORTEN_DECODED0 +#define IBSS_ATTR_SHORTEN_DECODED0 IBSS_ATTR #endif -struct codec_api* rb; -struct codec_api* ci; - int32_t decoded0[MAX_DECODE_SIZE] IBSS_ATTR_SHORTEN_DECODED0; int32_t decoded1[MAX_DECODE_SIZE] IBSS_ATTR; @@ -46,7 +35,7 @@ int32_t offset1[MAX_OFFSET_SIZE] IBSS_ATTR; int8_t ibuf[MAX_BUFFER_SIZE] IBSS_ATTR; /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api* api) +enum codec_status codec_main(void) { ShortenContext sc; uint32_t samplesdone; @@ -56,14 +45,6 @@ enum codec_status codec_start(struct codec_api* api) size_t bytesleft; /* Generic codec initialisation */ - rb = api; - ci = api; - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend-iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*128)); @@ -72,7 +53,7 @@ enum codec_status codec_start(struct codec_api* api) next_track: /* Codec initialization */ - if (codec_init(api)) { + if (codec_init()) { LOGF("Shorten: codec_init error\n"); return CODEC_ERROR; } diff --git a/apps/codecs/sid.c b/apps/codecs/sid.c index d356da7..58eb725 100644 --- a/apps/codecs/sid.c +++ b/apps/codecs/sid.c @@ -65,21 +65,10 @@ CODEC_HEADER #define CHUNK_SIZE (1024*2) - -struct codec_api *rb; - /* This codec supports SID Files: * */ -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - static int32_t samples[CHUNK_SIZE] IBSS_ATTR; /* The sample buffer */ /* Static buffer for the plain SID-File */ @@ -1213,9 +1202,8 @@ unsigned short LoadSIDFromMemory(void *pSidData, unsigned short *load_addr, } -enum codec_status codec_start(struct codec_api *api) +enum codec_status codec_main(void) { - struct codec_api *ci; size_t n, bytesfree; unsigned char *p; unsigned int filesize; @@ -1228,20 +1216,11 @@ enum codec_status codec_start(struct codec_api *api) int nSamplesToRender = 0; /* Generic codec initialisation */ - rb = api; - ci = api; - - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256)); next_track: - if (codec_init(api)) { + if (codec_init()) { return CODEC_ERROR; } @@ -1251,7 +1230,7 @@ next_track: /* Load SID file */ p = sidfile; bytesfree=sizeof(sidfile); - while ((n = rb->read_filebuf(p, bytesfree)) > 0) { + while ((n = ci->read_filebuf(p, bytesfree)) > 0) { p += n; bytesfree -= n; } diff --git a/apps/codecs/vorbis.c b/apps/codecs/vorbis.c index d08cb0e..ca4aa9d 100644 --- a/apps/codecs/vorbis.c +++ b/apps/codecs/vorbis.c @@ -23,14 +23,12 @@ CODEC_HEADER -static struct codec_api *rb; - /* Some standard functions and variables needed by Tremor */ size_t read_handler(void *ptr, size_t size, size_t nmemb, void *datasource) { (void)datasource; - return rb->read_filebuf(ptr, nmemb*size); + return ci->read_filebuf(ptr, nmemb*size); } int initial_seek_handler(void *datasource, ogg_int64_t offset, int whence) @@ -46,12 +44,12 @@ int seek_handler(void *datasource, ogg_int64_t offset, int whence) (void)datasource; if (whence == SEEK_CUR) { - offset += rb->curpos; + offset += ci->curpos; } else if (whence == SEEK_END) { - offset += rb->filesize; + offset += ci->filesize; } - if (rb->seek_buffer(offset)) { + if (ci->seek_buffer(offset)) { return 0; } @@ -67,7 +65,7 @@ int close_handler(void *datasource) long tell_handler(void *datasource) { (void)datasource; - return rb->curpos; + return ci->curpos; } /* This sets the DSP parameters based on the current logical bitstream @@ -81,32 +79,24 @@ bool vorbis_set_codec_parameters(OggVorbis_File *vf) vi = ov_info(vf, -1); if (vi == NULL) { - //rb->splash(HZ*2, true, "Vorbis Error"); + //ci->splash(HZ*2, true, "Vorbis Error"); return false; } - rb->configure(DSP_SWITCH_FREQUENCY, (int *)rb->id3->frequency); - codec_set_replaygain(rb->id3); + ci->configure(DSP_SWITCH_FREQUENCY, (int *)ci->id3->frequency); + codec_set_replaygain(ci->id3); if (vi->channels == 2) { - rb->configure(DSP_SET_STEREO_MODE, (int *)STEREO_NONINTERLEAVED); + ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_NONINTERLEAVED); } else if (vi->channels == 1) { - rb->configure(DSP_SET_STEREO_MODE, (int *)STEREO_MONO); + ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_MONO); } return true; } -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api *api) +enum codec_status codec_main(void) { ov_callbacks callbacks; OggVorbis_File vf; @@ -122,16 +112,9 @@ enum codec_status codec_start(struct codec_api *api) ogg_uint32_t vf_serialnos; ogg_int64_t vf_pcmlengths[2]; - rb = api; - - #ifdef USE_IRAM - rb->memcpy(iramstart, iramcopy, iramend - iramstart); - rb->memset(iedata, 0, iend - iedata); - #endif - - rb->configure(DSP_SET_SAMPLE_DEPTH, (long *)24); - rb->configure(DSP_SET_CLIP_MAX, (long *)((1 << 24) - 1)); - rb->configure(DSP_SET_CLIP_MIN, (long *)-((1 << 24) - 1)); + ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)24); + ci->configure(DSP_SET_CLIP_MAX, (long *)((1 << 24) - 1)); + ci->configure(DSP_SET_CLIP_MIN, (long *)-((1 << 24) - 1)); /* Note: These are sane defaults for these values. Perhaps * they should be set differently based on quality setting */ @@ -139,17 +122,17 @@ enum codec_status codec_start(struct codec_api *api) /* The chunk size below is magic. If set any lower, resume * doesn't work properly (ov_raw_seek() does the wrong thing). */ - rb->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(1024*256)); + ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (long *)(1024*256)); /* We need to flush reserver memory every track load. */ next_track: - if (codec_init(rb)) { + if (codec_init()) { error = CODEC_ERROR; goto exit; } - while (!*rb->taginfo_ready && !rb->stop_codec) - rb->sleep(1); + while (!*ci->taginfo_ready && !ci->stop_codec) + ci->sleep(1); /* Create a decoder instance */ callbacks.read_func = read_handler; @@ -158,14 +141,14 @@ next_track: callbacks.close_func = close_handler; /* Open a non-seekable stream */ - error = ov_open_callbacks(rb, &vf, NULL, 0, callbacks); + error = ov_open_callbacks(ci, &vf, NULL, 0, callbacks); /* If the non-seekable open was successful, we need to supply the missing * data to make it seekable. This is a hack, but it's reasonable since we * don't want to run the whole file through the buffer before we start * playing. Using Tremor's seekable open routine would cause us to do * this, so we pretend not to be seekable at first. Then we fill in the - * missing fields of vf with 1) information in rb->id3, and 2) info + * missing fields of vf with 1) information in ci->id3, and 2) info * obtained by Tremor in the above ov_open call. * * Note that this assumes there is only ONE logical Vorbis bitstream in our @@ -179,40 +162,40 @@ next_track: vf.pcmlengths = vf_pcmlengths; vf.offsets[0] = 0; - vf.offsets[1] = rb->id3->filesize; + vf.offsets[1] = ci->id3->filesize; vf.dataoffsets[0] = vf.offset; vf.pcmlengths[0] = 0; - vf.pcmlengths[1] = rb->id3->samples; + vf.pcmlengths[1] = ci->id3->samples; vf.serialnos[0] = vf.current_serialno; vf.callbacks.seek_func = seek_handler; vf.seekable = 1; - vf.end = rb->id3->filesize; + vf.end = ci->id3->filesize; vf.ready_state = OPENED; vf.links = 1; } else { - //rb->logf("ov_open: %d", error); + //ci->logf("ov_open: %d", error); error = CODEC_ERROR; goto done; } - if (rb->id3->offset) { - rb->advance_buffer(rb->id3->offset); - ov_raw_seek(&vf, rb->id3->offset); - rb->set_elapsed(ov_time_tell(&vf)); - rb->set_offset(ov_raw_tell(&vf)); + if (ci->id3->offset) { + ci->advance_buffer(ci->id3->offset); + ov_raw_seek(&vf, ci->id3->offset); + ci->set_elapsed(ov_time_tell(&vf)); + ci->set_offset(ov_raw_tell(&vf)); } eof = 0; while (!eof) { - rb->yield(); - if (rb->stop_codec || rb->new_track) + ci->yield(); + if (ci->stop_codec || ci->new_track) break; - if (rb->seek_time) { - if (ov_time_seek(&vf, rb->seek_time - 1)) { - //rb->logf("ov_time_seek failed"); + if (ci->seek_time) { + if (ov_time_seek(&vf, ci->seek_time - 1)) { + //ci->logf("ov_time_seek failed"); } - rb->seek_complete(); + ci->seek_complete(); } /* Read host-endian signed 24-bit PCM samples */ @@ -233,18 +216,18 @@ next_track: } else if (n < 0) { DEBUGF("Error decoding frame\n"); } else { - while (!rb->pcmbuf_insert_split(pcm[0], pcm[1], + while (!ci->pcmbuf_insert_split(pcm[0], pcm[1], n*sizeof(ogg_int32_t))) { - rb->sleep(1); + ci->sleep(1); } - rb->set_offset(ov_raw_tell(&vf)); - rb->set_elapsed(ov_time_tell(&vf)); + ci->set_offset(ov_raw_tell(&vf)); + ci->set_elapsed(ov_time_tell(&vf)); } } error = CODEC_OK; done: - if (rb->request_next_track()) { + if (ci->request_next_track()) { /* Clean things up for the next track */ vf.dataoffsets = NULL; vf.offsets = NULL; diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c index 9add1f5..26cbf7f 100644 --- a/apps/codecs/wav.c +++ b/apps/codecs/wav.c @@ -25,8 +25,6 @@ CODEC_HEADER /* Macro that sign extends an unsigned byte */ #define SE(x) ((int32_t)((int8_t)(x))) -struct codec_api *rb; - /* This codec support WAVE files with the following formats: * - PCM, up to 32 bits, supporting 32 bits playback when useful. * - ALAW and MULAW (16 bits compressed on 8 bits). @@ -95,14 +93,6 @@ enum /* for 44.1kHz stereo 16bits, this represents 0.023s ~= 1/50s */ #define WAV_CHUNK_SIZE (1024*2) -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - static const int16_t alaw2linear16[256] ICONST_ATTR = { -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, -7552, -7296, -8064, -7808, -6528, -6272, @@ -213,9 +203,8 @@ decode_dvi_adpcm(struct codec_api *ci, size_t *pcmoutsize); /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api *api) +enum codec_status codec_main(void) { - struct codec_api *ci; uint32_t numbytes, bytesdone; uint32_t totalsamples = 0; uint16_t channels = 0; @@ -235,20 +224,12 @@ enum codec_status codec_start(struct codec_api *api) /* Generic codec initialisation */ - rb = api; - ci = api; - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28); ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256)); next_track: - if (codec_init(api)) { + if (codec_init()) { i = CODEC_ERROR; goto exit; } diff --git a/apps/codecs/wav_enc.c b/apps/codecs/wav_enc.c index 974a903..ff49238 100644 --- a/apps/codecs/wav_enc.c +++ b/apps/codecs/wav_enc.c @@ -24,14 +24,6 @@ CODEC_ENC_HEADER -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - struct riff_header { uint8_t riff_id[4]; /* 00h - "RIFF" */ @@ -65,7 +57,6 @@ struct riff_header #define PCM_SAMP_PER_CHUNK 2048 #define PCM_CHUNK_SIZE (PCM_SAMP_PER_CHUNK*4) -static struct codec_api *ci; static int num_channels; uint32_t sample_rate; uint32_t enc_size; @@ -321,17 +312,10 @@ static bool init_encoder(void) } /* init_encoder */ /* main codec entry point */ -enum codec_status codec_start(struct codec_api* api) +enum codec_status codec_main(void) { bool cpu_boosted; - ci = api; // copy to global api pointer - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - if (!init_encoder()) { ci->enc_codec_loaded = -1; diff --git a/apps/codecs/wavpack.c b/apps/codecs/wavpack.c index 6528053..e2c19c8 100644 --- a/apps/codecs/wavpack.c +++ b/apps/codecs/wavpack.c @@ -22,8 +22,6 @@ CODEC_HEADER -static struct codec_api *ci; - #define BUFFER_SIZE 4096 static int32_t temp_buffer [BUFFER_SIZE] IBSS_ATTR; @@ -35,16 +33,8 @@ static int32_t read_callback (void *buffer, int32_t bytes) return retval; } -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - /* this is the codec entry point */ -enum codec_status codec_start(struct codec_api* api) +enum codec_status codec_main(void) { WavpackContext *wpc; char error [80]; @@ -52,13 +42,6 @@ enum codec_status codec_start(struct codec_api* api) int retval; /* Generic codec initialisation */ - ci = api; - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend-iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*128)); @@ -66,7 +49,7 @@ enum codec_status codec_start(struct codec_api* api) next_track: - if (codec_init(api)) { + if (codec_init()) { retval = CODEC_ERROR; goto exit; } diff --git a/apps/codecs/wavpack_enc.c b/apps/codecs/wavpack_enc.c index 5318abc..cee8c40 100644 --- a/apps/codecs/wavpack_enc.c +++ b/apps/codecs/wavpack_enc.c @@ -24,14 +24,6 @@ CODEC_ENC_HEADER -#ifdef USE_IRAM -extern char iramcopy[]; -extern char iramstart[]; -extern char iramend[]; -extern char iedata[]; -extern char iend[]; -#endif - /** Types **/ typedef struct { @@ -73,7 +65,6 @@ struct riff_header #define PCM_CHUNK_SIZE (4*PCM_SAMP_PER_CHUNK) /** Data **/ -static struct codec_api *ci; static int8_t input_buffer[PCM_CHUNK_SIZE*2] IBSS_ATTR; static WavpackConfig config IBSS_ATTR; static WavpackContext *wpc; @@ -381,17 +372,10 @@ static bool init_encoder(void) return true; } /* init_encoder */ -enum codec_status codec_start(struct codec_api* api) +enum codec_status codec_main(void) { bool cpu_boosted; - ci = api; /* copy to global api pointer */ - -#ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif - /* initialize params and config */ if (!init_encoder()) { -- cgit v1.1