summaryrefslogtreecommitdiffstats
path: root/apps/codecs
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/Tremor/vorbisfile.c19
-rw-r--r--apps/codecs/codec.h1
-rw-r--r--apps/codecs/liba52/parse.c2
-rw-r--r--apps/codecs/libmad/imdct_mcf5249.S1
-rw-r--r--apps/codecs/libmad/layer3.c2
-rw-r--r--apps/codecs/libmad/synth.c7
-rw-r--r--apps/codecs/libmusepack/mpc_decoder.c4
-rw-r--r--apps/codecs/libmusepack/synth_filter.c3
-rw-r--r--apps/codecs/mpa.c3
9 files changed, 18 insertions, 24 deletions
diff --git a/apps/codecs/Tremor/vorbisfile.c b/apps/codecs/Tremor/vorbisfile.c
index 92f42a313b..70c0cdb24e 100644
--- a/apps/codecs/Tremor/vorbisfile.c
+++ b/apps/codecs/Tremor/vorbisfile.c
@@ -762,6 +762,12 @@ int ov_clear(OggVorbis_File *vf){
int ov_open_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
ov_callbacks callbacks){
+ #if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
+ /* this seems to be the closest we get to an init function, let's init emac
+ here. rounding is disabled because of MULT31_SHIFT15, which will be
+ inaccurate with rounding in its current incarnation */
+ coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE);
+ #endif
int ret=_ov_open1(f,vf,initial,ibytes,callbacks);
if(ret)return ret;
return _ov_open2(vf);
@@ -1287,15 +1293,12 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
ogg_packet op={0,0,0,0,0,0};
ogg_page og={0,0,0,0};
+
int thisblock,lastblock=0;
int ret=ov_pcm_seek_page(vf,pos);
if(ret<0)return(ret);
_make_decode_ready(vf);
-#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
- mcf5249_init_mac();
-#endif
-
/* discard leading packets we don't need for the lapping of the
position we want; don't decode them */
@@ -1553,10 +1556,6 @@ long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
if(vf->ready_state<OPENED)return(OV_EINVAL);
-#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
- mcf5249_init_mac();
-#endif
-
while(1){
if(vf->ready_state==INITSET){
samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
@@ -1622,10 +1621,6 @@ long ov_read_fixed(OggVorbis_File *vf,ogg_int32_t ***pcm_channels,int length,
int *bitstream){
if(vf->ready_state<OPENED)return(OV_EINVAL);
-#if CONFIG_CPU == MCF5249
- mcf5249_init_mac();
-#endif
-
while(1){
if(vf->ready_state==INITSET){
ogg_int32_t **pcm;
diff --git a/apps/codecs/codec.h b/apps/codecs/codec.h
index c00d2bda95..0da653cf04 100644
--- a/apps/codecs/codec.h
+++ b/apps/codecs/codec.h
@@ -20,6 +20,7 @@
/* Global declarations to be used in rockbox software codecs */
#include "config.h"
+#include "system.h"
#include <sys/types.h>
diff --git a/apps/codecs/liba52/parse.c b/apps/codecs/liba52/parse.c
index d5b323c701..9e7ed47d56 100644
--- a/apps/codecs/liba52/parse.c
+++ b/apps/codecs/liba52/parse.c
@@ -59,7 +59,7 @@ a52_state_t * a52_init (uint32_t mm_accel)
int i;
#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
- asm volatile ("move.l #0x30, %macsr"); /* frac. mode with rounding */
+ coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_ROUND | EMAC_SATURATE);
#endif
/*
this needs to come back if we ever want two decoder instances
diff --git a/apps/codecs/libmad/imdct_mcf5249.S b/apps/codecs/libmad/imdct_mcf5249.S
index 62b33c3f07..1afd910fa8 100644
--- a/apps/codecs/libmad/imdct_mcf5249.S
+++ b/apps/codecs/libmad/imdct_mcf5249.S
@@ -32,7 +32,6 @@ III_imdct_s:
* get more low bits out of the accext01 register _before_ doing the
* movclrs.
*/
- move.l #0xb0, %macsr /* frac mode, saturation, rounding */
sub.l %a0, %a0 /* clear loop variable */
.imdctloop: /* outer loop label */
lea.l imdct_s, %a1 /* load pointer to imdct coefs in a1 */
diff --git a/apps/codecs/libmad/layer3.c b/apps/codecs/libmad/layer3.c
index b5fa2be6f5..6d528ea52c 100644
--- a/apps/codecs/libmad/layer3.c
+++ b/apps/codecs/libmad/layer3.c
@@ -1775,8 +1775,6 @@ void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36])
mad_fixed_t t[16];
/* assumes FRACBITS = 28 */
asm volatile (
- "move.l #0xb0, %%d0\n\t" /* frac. mode, saturate, round */
- "move.l %%d0, %%macsr\n\t"
"move.l (4*4, %[X]), %%d0\n\t"
"move.l #0x0ec835e8, %%d1\n\t"
"mac.l %%d0, %%d1, (13*4, %[X]), %%d0, %%acc0\n\t"
diff --git a/apps/codecs/libmad/synth.c b/apps/codecs/libmad/synth.c
index bdec4258fb..4315e239e8 100644
--- a/apps/codecs/libmad/synth.c
+++ b/apps/codecs/libmad/synth.c
@@ -42,6 +42,11 @@ void mad_synth_init(struct mad_synth *synth)
synth->pcm.samplerate = 0;
synth->pcm.channels = 0;
synth->pcm.length = 0;
+ #if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
+ /* init the emac unit here, since this function should always be called
+ before using libmad */
+ coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE | EMAC_ROUND);
+ #endif
}
/*
@@ -582,8 +587,6 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
mad_fixed_t const (*Dptr)[32];
mad_fixed64hi_t hi;
- asm volatile("move.l #0x20, %macsr"); /* fractional mode */
-
for (ch = 0; ch < nch; ++ch) {
sbsample = &frame->sbsample[ch];
filter = &synth->filter[ch];
diff --git a/apps/codecs/libmusepack/mpc_decoder.c b/apps/codecs/libmusepack/mpc_decoder.c
index 0c8b8b76a7..a37dc4583c 100644
--- a/apps/codecs/libmusepack/mpc_decoder.c
+++ b/apps/codecs/libmusepack/mpc_decoder.c
@@ -1173,6 +1173,10 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r)
mpc_decoder_initialisiere_quantisierungstabellen(d, 1.0f);
mpc_decoder_init_huffman_sv6(d);
mpc_decoder_init_huffman_sv7(d);
+
+ #if defined(CPU_COLDFIRE)&& !defined(SIMULATOR)
+ coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_ROUND | EMAC_SATURATE);
+ #endif
}
static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si)
diff --git a/apps/codecs/libmusepack/synth_filter.c b/apps/codecs/libmusepack/synth_filter.c
index 7644551d16..51ffcce921 100644
--- a/apps/codecs/libmusepack/synth_filter.c
+++ b/apps/codecs/libmusepack/synth_filter.c
@@ -335,9 +335,6 @@ static void Synthese_Filter_float_internal(MPC_SAMPLE_FORMAT * OutData,MPC_SAMPL
{
mpc_uint32_t n;
- #if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
- asm volatile ("move.l #0x20, %macsr"); /* fractional emac mode */
- #endif
for ( n = 0; n < 36; n++, Y += 32 ) {
V -= 64;
Calculate_New_V ( Y, V );
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index 7beecd9edb..9970d57240 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -114,9 +114,6 @@ enum codec_status codec_start(struct codec_api* api)
ci->memset(&Synth, 0, sizeof(struct mad_synth));
ci->memset(&Timer, 0, sizeof(mad_timer_t));
-#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
- mcf5249_init_mac();
-#endif
mad_stream_init(&Stream);
mad_frame_init(&Frame);
mad_synth_init(&Synth);