Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ESP32-audioI2S
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ESP32-audioI2S
Commits
c33c4c01
Unverified
Commit
c33c4c01
authored
May 27, 2022
by
Wolle
Committed by
GitHub
May 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allocate decoder buffers in PSRAM if chipmodel is ESP32-S3
parent
cc49568c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
src/mp3_decoder/mp3_decoder.cpp
src/mp3_decoder/mp3_decoder.cpp
+11
-5
No files found.
src/mp3_decoder/mp3_decoder.cpp
View file @
c33c4c01
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* libhelix_HMP3DECODER
* libhelix_HMP3DECODER
*
*
* Created on: 26.10.2018
* Created on: 26.10.2018
* Updated on:
03.01
.2022
* Updated on:
27.05
.2022
*/
*/
#include "mp3_decoder.h"
#include "mp3_decoder.h"
/* clip to range [-2^n, 2^n - 1] */
/* clip to range [-2^n, 2^n - 1] */
...
@@ -1527,12 +1527,18 @@ void MP3Decoder_ClearBuffer(void) {
...
@@ -1527,12 +1527,18 @@ void MP3Decoder_ClearBuffer(void) {
* allocated before returning
* allocated before returning
*
*
**********************************************************************************************************************/
**********************************************************************************************************************/
/* the default is to allocate everything over 4k preferably in PSRAM, see components/heap/heap_caps.c in esp-idf
* but we prefer internal RAM as it is faster */
#ifdef CONFIG_IDF_TARGET_ESP32S3
#define __malloc_heap_psram(size) \
// ESP32-S3: If there is PSRAM, prefer it
#define __malloc_heap_psram(size) \
heap_caps_malloc_prefer
(
size
,
2
,
MALLOC_CAP_DEFAULT
|
MALLOC_CAP_SPIRAM
,
MALLOC_CAP_DEFAULT
|
MALLOC_CAP_INTERNAL
)
#else
// ESP32, PSRAM is too slow, prefer SRAM
#define __malloc_heap_psram(size) \
heap_caps_malloc_prefer
(
size
,
2
,
MALLOC_CAP_DEFAULT
|
MALLOC_CAP_INTERNAL
,
MALLOC_CAP_DEFAULT
|
MALLOC_CAP_SPIRAM
)
heap_caps_malloc_prefer
(
size
,
2
,
MALLOC_CAP_DEFAULT
|
MALLOC_CAP_INTERNAL
,
MALLOC_CAP_DEFAULT
|
MALLOC_CAP_SPIRAM
)
bool
MP3Decoder_AllocateBuffers
(
void
)
{
#endif
bool
MP3Decoder_AllocateBuffers
(
void
)
{
if
(
!
m_MP3DecInfo
)
{
m_MP3DecInfo
=
(
MP3DecInfo_t
*
)
__malloc_heap_psram
(
sizeof
(
MP3DecInfo_t
)
);}
if
(
!
m_MP3DecInfo
)
{
m_MP3DecInfo
=
(
MP3DecInfo_t
*
)
__malloc_heap_psram
(
sizeof
(
MP3DecInfo_t
)
);}
if
(
!
m_FrameHeader
)
{
m_FrameHeader
=
(
FrameHeader_t
*
)
__malloc_heap_psram
(
sizeof
(
FrameHeader_t
)
);}
if
(
!
m_FrameHeader
)
{
m_FrameHeader
=
(
FrameHeader_t
*
)
__malloc_heap_psram
(
sizeof
(
FrameHeader_t
)
);}
if
(
!
m_SideInfo
)
{
m_SideInfo
=
(
SideInfo_t
*
)
__malloc_heap_psram
(
sizeof
(
SideInfo_t
)
);}
if
(
!
m_SideInfo
)
{
m_SideInfo
=
(
SideInfo_t
*
)
__malloc_heap_psram
(
sizeof
(
SideInfo_t
)
);}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment