mstorsjo / fdk-aac

A standalone library of the Fraunhofer FDK AAC code from Android.
https://sourceforge.net/projects/opencore-amr/
Other
1.18k stars 389 forks source link

Memory usage #15

Open georgesterpu opened 10 years ago

georgesterpu commented 10 years ago

Hello,

It looks like whole encoder library allocates up to 240 KB of memory, while the only two modules needed for the ELD profile (AAC + SBR) takes about 170 KB of ram (mono channel). Could these sizes be lowered down even more for the ELD profile only?

I initialize the encoder as following: aacEncOpen(&handle, (0x01 | 0x02), channels)

The goal is to squeeze AAC ELD on my 64KB demo board and even leave some room for other modules.

georgesterpu commented 10 years ago

Any idea what these constants might mean?

define INPUTBUFFER_SIZE (1537+100+2048)

mstorsjo commented 10 years ago

I'm guessing the maximum number of samples input for one packet (plus some padding or other details used internally, in addition to the samples input by the user).

georgesterpu commented 10 years ago

For LD filterbanks (blockSwitchingOffset = granuleLength), it looks to me that the inputBuffer should be at least (nr_channels x granuleLength) wide.

I only use two channels and 512 granuleLength, so a buffer size of 1024 was enough, but could it be a problem for other scenarios (more than 1537+100+2048 samples required) ?