libopus: Re-add another optimization that was accidently dropped pre-3.15

This puts the entire ~26K decoder state structure into IRAM.

(was lost as part of 14c6bb798d, Nov 2019)

Change-Id: Idbf53657e7c0581b4e47247fc5550b59842b23f1
This commit is contained in:
Solomon Peachy 2025-02-12 08:49:41 -05:00
parent 922a2a4f3d
commit dc0cef8304

View file

@ -156,6 +156,10 @@ int opus_decoder_init(OpusDecoder *st, opus_int32 Fs, int channels)
return OPUS_OK;
}
/* Rockbox optimization */
#define STATIC_DECODER_SIZE 26548 /* 26548 for 2ch 64bit environment */
static char s_dec[STATIC_DECODER_SIZE] IBSS_ATTR MEM_ALIGN_ATTR;
OpusDecoder *opus_decoder_create(opus_int32 Fs, int channels, int *error)
{
int ret;
@ -167,7 +171,11 @@ OpusDecoder *opus_decoder_create(opus_int32 Fs, int channels, int *error)
*error = OPUS_BAD_ARG;
return NULL;
}
st = (OpusDecoder *)opus_alloc(opus_decoder_get_size(channels));
if (STATIC_DECODER_SIZE >= opus_decoder_get_size(channels))
st = (OpusDecoder *)s_dec;
else
st = (OpusDecoder *)opus_alloc(opus_decoder_get_size(channels));
if (st == NULL)
{
if (error)