summaryrefslogtreecommitdiffstats
path: root/apps/codecs/libmusepack/mpc_decoder.c
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2008-05-19 18:06:00 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2008-05-19 18:06:00 +0000
commit1d28fe7d798eaad14e7e4553d4af6c8082309126 (patch)
treeafcd2f46938300dff183d58e4690d1999af17c67 /apps/codecs/libmusepack/mpc_decoder.c
parent69fc5ad48a5d8063cc0d94da8c1db5d141341dc5 (diff)
downloadrockbox-1d28fe7d798eaad14e7e4553d4af6c8082309126.tar.gz
rockbox-1d28fe7d798eaad14e7e4553d4af6c8082309126.zip
Musepack seek hotfix. Do not dynamically allocate seek buffer but use a buffer of constant size (~28.5min). Files larger than this will still not seek properly. Some additional rework has to be done for the seek buffer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17584 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libmusepack/mpc_decoder.c')
-rw-r--r--apps/codecs/libmusepack/mpc_decoder.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/apps/codecs/libmusepack/mpc_decoder.c b/apps/codecs/libmusepack/mpc_decoder.c
index f7687c5bad..fa3295357c 100644
--- a/apps/codecs/libmusepack/mpc_decoder.c
+++ b/apps/codecs/libmusepack/mpc_decoder.c
@@ -118,6 +118,7 @@ static mpc_uint32_t get_initial_fpos(mpc_decoder *d, mpc_uint32_t StreamVersion)
static inline mpc_int32_t mpc_decoder_huffman_decode_fastest(mpc_decoder *d, const HuffmanTyp* Table, const mpc_uint8_t* tab, mpc_uint16_t unused_bits);
static void mpc_move_next(mpc_decoder *d);
+mpc_uint32_t Seekbuffer[MPC_SEEK_BUFFER_SIZE];
mpc_uint32_t Speicher[MPC_DECODER_MEMSIZE];
MPC_SAMPLE_FORMAT Y_L[36][32] IBSS_ATTR_MPC_LARGE_IRAM;
MPC_SAMPLE_FORMAT Y_R[36][32] IBSS_ATTR_MPC_LARGE_IRAM;
@@ -1458,6 +1459,7 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r)
LOOKUP ( mpc_table_HuffQ[1][7], 63, LUT7_1 );
LOOKUP ( mpc_table_HuffDSCF, 16, LUTDSCF );
+ d->SeekTable = Seekbuffer;
d->Speicher = Speicher;
d->Y_L = Y_L;
d->Y_R = Y_R;
@@ -1467,12 +1469,6 @@ void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r)
#endif
}
-void mpc_decoder_destroy(mpc_decoder *d)
-{
- if (d->SeekTable != NULL)
- free(d->SeekTable);
-}
-
static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si)
{
mpc_uint32_t seekTableSize;
@@ -1490,11 +1486,9 @@ static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si)
d->samples_to_skip = MPC_DECODER_SYNTH_DELAY;
- if (d->SeekTable != NULL)
- free(d->SeekTable);
+ memset(d->SeekTable, 0, sizeof(Seekbuffer));
- seekTableSize = si->frames;
- d->SeekTable = (mpc_uint32_t*) calloc( sizeof(mpc_uint32_t), seekTableSize);
+ seekTableSize = min(si->frames, MPC_SEEK_BUFFER_SIZE);
d->SeekTable_Step = si->frames / seekTableSize;
if (si->frames % seekTableSize)
d->SeekTable_Step+=1;