diff options
Diffstat (limited to 'apps/codecs')
-rw-r--r-- | apps/codecs/libmusepack/decoder.h | 3 | ||||
-rw-r--r-- | apps/codecs/libmusepack/mpc_decoder.c | 14 | ||||
-rw-r--r-- | apps/codecs/libmusepack/musepack.h | 3 | ||||
-rw-r--r-- | apps/codecs/mpc.c | 1 |
4 files changed, 6 insertions, 15 deletions
diff --git a/apps/codecs/libmusepack/decoder.h b/apps/codecs/libmusepack/decoder.h index 1f78d53c8d..b035ae9574 100644 --- a/apps/codecs/libmusepack/decoder.h +++ b/apps/codecs/libmusepack/decoder.h @@ -48,7 +48,8 @@ enum { MPC_V_MEM = 2304, - MPC_DECODER_MEMSIZE = 16384, // overall buffer size + MPC_DECODER_MEMSIZE = 16384, // overall buffer size (words) + MPC_SEEK_BUFFER_SIZE = 65536, // seek buffer size (words) }; typedef struct { 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; diff --git a/apps/codecs/libmusepack/musepack.h b/apps/codecs/libmusepack/musepack.h index 9bdebf8b04..b9aff48427 100644 --- a/apps/codecs/libmusepack/musepack.h +++ b/apps/codecs/libmusepack/musepack.h @@ -154,9 +154,6 @@ mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample); /// Seeks to specified position in seconds in the source stream. mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds); -/// Cleans up the decoder (seektable) -void mpc_decoder_destroy(mpc_decoder *d); - #ifdef __cplusplus } #endif // __cplusplus diff --git a/apps/codecs/mpc.c b/apps/codecs/mpc.c index c734915f68..79264d3bfc 100644 --- a/apps/codecs/mpc.c +++ b/apps/codecs/mpc.c @@ -188,7 +188,6 @@ done: goto next_track; exit: - mpc_decoder_destroy(&decoder); return retval; } |