diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-02-07 21:29:28 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-02-07 21:38:05 +1100 |
| commit | c1b03c151edc12f9ec46e63ae6fd2744dc2f59b5 (patch) | |
| tree | 62b5aa4c6f125d79c5b99865d247bbef97294c4e /lib/opusfile | |
| parent | 18345a1c2c357d194c9eda8bf2103db9965d3996 (diff) | |
| download | tangara-fw-c1b03c151edc12f9ec46e63ae6fd2744dc2f59b5.tar.gz | |
put opus' allocations into internal ram
it's a pretty chonky codec, but this seems like the best way to tame its
performance.
Diffstat (limited to 'lib/opusfile')
| -rw-r--r-- | lib/opusfile/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | lib/opusfile/include/custom_support.h | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/opusfile/CMakeLists.txt b/lib/opusfile/CMakeLists.txt index 94d1af9e..f9b5e4ce 100644 --- a/lib/opusfile/CMakeLists.txt +++ b/lib/opusfile/CMakeLists.txt @@ -17,4 +17,6 @@ set(OPUS_BUILD_TESTING OFF) set(OPUS_BUILD_SHARED_LIBS OFF) add_subdirectory($ENV{PROJ_PATH}/lib/opus ${CMAKE_CURRENT_BINARY_DIR}/opus) +target_compile_definitions(opus PRIVATE CUSTOM_SUPPORT) +target_include_directories(opus PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) target_link_libraries(${COMPONENT_LIB} PUBLIC opus) 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); +} |
