dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: Opus codec developments

Re: Opus codec developments

From: Bertrik Sikken <>
Date: Fri, 27 Jul 2012 15:24:07 +0200

On 26-7-2012 8:25, Rafaël Carré wrote:
> Le 2012-07-26 14:08, Bertrik Sikken a écrit :
>> Stuff that still needs work:
>> * Memory allocation in the codec main is not fully consistent yet (probably
>> leaking some memory), so playing several files in sequence may not work
> What do you mean by leak?
> codec_free() is a void operation, all memory which is malloc() (or
> realloc()) is lost (until next file I hope).

Actually, I think I was wrong and the problem I was seeing has probably
little to do with memory allocation. I'm still seeing that playing two
particular files in sequence makes the second one skip because an error
was detected during opus_decode() of a specific packet.
Not completely sure yet what is happening there.

> Ideally we should go and replace malloc() by static buffers using worst
> case possibilities when possible.

The mallocs still being done, are done only at initialisation time,
there is no malloc/free during playback, so using malloc for these
is fine IMO. We can initialise the malloc subsystem (e.g. through
a call to codec_init()) for each file we play.
I think this should work and isn't so bad; conversion to static buffers
probably requires changes (e.g. in ogg and opus) that probably make it
harder to sync with upstream later.

>> * Stack usage is still quite high, I've seen about 10k for music and 36k
>> for speech on the clip zip, our stacks are currently 10kB by default.
> I'd guess some big buffers are allocated on stack (rather than usage
> being due to recursion)

Gregory Maxwell from opus was looking into this a bit and I think he
identified the largest stack users. I guess this will end up being
a change in opus itself.

>> * Applying global gain from the opus audio file is not implemented
>> (not sure if replaygain is working)
> Fixed (it's part of the codec, not related to replaygain although we
> might want to implement replaygain for e.g. vorbis too).


(Replaygain for vorbis/upus doesn't look that complicated really, BTW).

Received on 2012-07-27

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy