Repository navigation
dmmp3: the decoder's state in fast memory, when the system has it - #3
Merged
Merged
Conversation
minimp3's state and its scratch - 23 kB worked on for every frame - are a block of their own, allocated as "fast" memory (Dmod_MallocTagged): a heap the system tags so, else the default memory. On an STM32F746 with its SDRAM behind a 4 kB data cache decoding took 70 % of the CPU there, 15 % in the DTCM. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A player goes from file to file: the state freed and allocated again could lose its fast memory - something small taking a part of the place meanwhile, the next one not fitting (seen on the board: the DTCM's block was 28 bytes short after a track changed). The block of a closed decoder is kept for the next one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JohnAmadis
force-pushed
the
perf/decoder-heap
branch
from
October 18, 2026 06:29
92dad73 to
bf62c84
Compare
JohnAmadis
approved these changes
Oct 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
minimp3's state and its scratch - 23 kB worked on for every frame - are now a block of their own, allocated as "fast" memory:
Dmod_MallocTagged("fast", sizeof(state_t))- a heap the system tagsfast(dmheap: a heap's name is the list of its tags), when it has one with room, else the default memory. The rest of a decoder (16 kB of the file, a frame of samples) stays where it was.A closed decoder's state is kept for the next one (one block): a player goes from file to file, and the block freed and allocated again could lose its fast memory - on the board something small took a part of the place meanwhile, and the next state was 28 bytes short.
Why
On the STM32F746G Discovery the default memory is the SDRAM behind a 4 kB data cache. Playing a 44.1 kHz stereo MP3 in carhmi-demo, sampled with a debugger:
With the decoding at 70 % the views (below the player's priority) got a few frames a second.
Depends on
Dmod_MallocTagged()(its default:Dmod_MallocEx(), so on the host and on systems without tagged heaps nothing changes);Dmod_MallocTaggedEx()on a device;fast(PR to come).CI builds against dmod's develop: it passes once dmod#332 is merged.
Tests
5/5 on the host (against dmod#332's dmod_loader).
🤖 Generated with Claude Code