minimp3 icon indicating copy to clipboard operation
minimp3 copied to clipboard

Reduce stack usage to help usage on embedded systems

Open chmorgan opened this issue 2 years ago • 5 comments

chmorgan avatar Oct 06 '23 01:10 chmorgan

This is useful to me. It would be nice if it would be merged.

vmsh0 avatar Aug 14 '24 19:08 vmsh0

@vmsh0 feel free to use my fork and let me know how it goes. I'm using it here on stm32 targets.

chmorgan avatar Aug 14 '24 20:08 chmorgan

I swapped this in in place of the mainline version, was able to reduce the stack size of my decoder task by more than 20k. Big success! Thanks.

vmsh0 avatar Aug 15 '24 06:08 vmsh0

While I would also like to see reduced stack usage, the approach implemented here does not really work: When using minimp3 in a separate translation unit (i.e. without MINIMP3_IMPLEMENTATION defined), mp3dec_t is now an incomplete type that cannot be used at all, which makes the whole API unusable.

manxorist avatar Aug 15 '24 14:08 manxorist

While I would also like to see reduced stack usage, the approach implemented here does not really work: When using minimp3 in a separate translation unit (i.e. without MINIMP3_IMPLEMENTATION defined), mp3dec_t is now an incomplete type that cannot be used at all, which makes the whole API unusable.

The API could be extended to have an "init" method, dynamically allocating a mp3dec_t structure. This would probably benefit from #114

vmsh0 avatar Aug 15 '24 14:08 vmsh0