forked from len0rd/rockbox
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:
parent
922a2a4f3d
commit
dc0cef8304
1 changed files with 9 additions and 1 deletions
|
@ -156,6 +156,10 @@ int opus_decoder_init(OpusDecoder *st, opus_int32 Fs, int channels)
|
||||||
return OPUS_OK;
|
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)
|
OpusDecoder *opus_decoder_create(opus_int32 Fs, int channels, int *error)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -167,7 +171,11 @@ OpusDecoder *opus_decoder_create(opus_int32 Fs, int channels, int *error)
|
||||||
*error = OPUS_BAD_ARG;
|
*error = OPUS_BAD_ARG;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (STATIC_DECODER_SIZE >= opus_decoder_get_size(channels))
|
||||||
|
st = (OpusDecoder *)s_dec;
|
||||||
|
else
|
||||||
st = (OpusDecoder *)opus_alloc(opus_decoder_get_size(channels));
|
st = (OpusDecoder *)opus_alloc(opus_decoder_get_size(channels));
|
||||||
|
|
||||||
if (st == NULL)
|
if (st == NULL)
|
||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue