diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-02-14 17:48:13 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-02-14 17:48:13 +1100 |
| commit | c5917658e6a0fcc77971237c80bb4e47f3e8bf9e (patch) | |
| tree | 276e22c832da1d23b7ad43ad819a855f10b8d92e | |
| parent | 10770e0f5445bd39e5778a104fafd1788f9f62d7 (diff) | |
| download | tangara-fw-c5917658e6a0fcc77971237c80bb4e47f3e8bf9e.tar.gz | |
Cram one of the flac samples buffers into internal ram
Can't quite fit the second... yet. Just one is a pretty reasonable
speedup, though! Probably bc we're not hammering the spiram cache so
hard.
| -rw-r--r-- | src/codecs/miniflac.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/codecs/miniflac.cpp b/src/codecs/miniflac.cpp index ace73466..74eafb3b 100644 --- a/src/codecs/miniflac.cpp +++ b/src/codecs/miniflac.cpp @@ -30,9 +30,16 @@ MiniFlacDecoder::MiniFlacDecoder() current_sample_() { miniflac_init(flac_.get(), MINIFLAC_CONTAINER_UNKNOWN); for (int i = 0; i < samples_by_channel_.size(); i++) { - // Full decoded frames too big to fit in internal ram :( + uint32_t caps; + if (i == 0) { + caps = MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL; + } else { + // FIXME: We can *almost* fit two channels into internal ram, but we're a + // few KiB shy of being able to do it safely. + caps = MALLOC_CAP_SPIRAM; + } samples_by_channel_[i] = reinterpret_cast<int32_t*>( - heap_caps_malloc(kMaxFrameSize * sizeof(int32_t), MALLOC_CAP_SPIRAM)); + heap_caps_malloc(kMaxFrameSize * sizeof(int32_t), caps)); } } |
