From c1b03c151edc12f9ec46e63ae6fd2744dc2f59b5 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 7 Feb 2024 21:29:28 +1100 Subject: put opus' allocations into internal ram it's a pretty chonky codec, but this seems like the best way to tame its performance. --- lib/opusfile/include/custom_support.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/opusfile/include/custom_support.h (limited to 'lib/opusfile/include') diff --git a/lib/opusfile/include/custom_support.h b/lib/opusfile/include/custom_support.h new file mode 100644 index 00000000..d99cc5e2 --- /dev/null +++ b/lib/opusfile/include/custom_support.h @@ -0,0 +1,17 @@ +#pragma once + +#include "esp_heap_caps.h" +#include "opus_defines.h" + +#define OVERRIDE_OPUS_ALLOC +#define OVERRIDE_OPUS_FREE + +static OPUS_INLINE void *opus_alloc (size_t size) +{ + return heap_caps_malloc(size, MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); +} + +static OPUS_INLINE void opus_free (void *ptr) +{ + heap_caps_free(ptr); +} -- cgit v1.2.3