summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-11-07 13:37:58 +1100
committerjacqueline <me@jacqueline.id.au>2023-11-07 13:37:58 +1100
commit9dc8f5646c0d4741636396b0c08309263af5e323 (patch)
tree2342bc4c82615c998417c0551097705593d3fc95
parent9b52fad86eb44c80f8e5dafcb460a71e38c1ff6e (diff)
downloadtangara-fw-9dc8f5646c0d4741636396b0c08309263af5e323.tar.gz
Make foxenflac a little less memory hungry
We should really just use the xiph library :/
-rw-r--r--lib/libfoxenflac/flac.c2
-rw-r--r--src/codecs/foxenflac.cpp8
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/libfoxenflac/flac.c b/lib/libfoxenflac/flac.c
index d65ada3e..d4030e11 100644
--- a/lib/libfoxenflac/flac.c
+++ b/lib/libfoxenflac/flac.c
@@ -305,7 +305,7 @@ static inline uint64_t fx_bitstream_peek_msb(fx_bitstream_t *reader,
* optimization. Furthermore, some platforms (WASM) do not allow unaligned
* memory access.
*/
-#define FX_ALIGN 16
+#define FX_ALIGN 1
/**
* Macro telling the compiler that P is aligned with the specified alignment
diff --git a/src/codecs/foxenflac.cpp b/src/codecs/foxenflac.cpp
index 7d11d4f1..1fd95cd1 100644
--- a/src/codecs/foxenflac.cpp
+++ b/src/codecs/foxenflac.cpp
@@ -19,7 +19,13 @@ namespace codecs {
[[maybe_unused]] static const char kTag[] = "flac";
FoxenFlacDecoder::FoxenFlacDecoder()
- : input_(), buffer_(), flac_(FX_FLAC_ALLOC(FLAC_MAX_BLOCK_SIZE, 2)) {}
+ : input_(),
+ buffer_(),
+ flac_(fx_flac_init(
+ heap_caps_malloc(fx_flac_size(FLAC_SUBSET_MAX_BLOCK_SIZE_48KHZ, 2),
+ MALLOC_CAP_SPIRAM),
+ FLAC_SUBSET_MAX_BLOCK_SIZE_48KHZ,
+ 2)) {}
FoxenFlacDecoder::~FoxenFlacDecoder() {
free(flac_);