Dear Ralph
Thank you for your info. My file_read() function only get a specified number
(nbBytes) of bytes from the .ogg file and store it in cbits, nothing else
lb = file_read(&file, nbBytes, (void *)cbits);
Unfortunately I have only 32K (first section) + 8 (second section) = 40 Kbyte of
RAM to do all, including the file system management (I get the FS from the EFSL
project).
Speex requires more or less 18600 byte for the heap (I don't like to have
malloc function in my code ...) and the remaining space of the 32Kbyte of RAM is
used for the speex variables and for the EFS library. I have only a few bytes to
complete the first 32Kbyte section, Regarding the remaining 8kbyte section I use
it for the stack.
I don't have an additional RAM, and franking specking I don't want to
put nose in the detail of the speex library. I can only conclude that speex, is
not suitable for architecture with a limited memory foot-print at the moment.
Furthermore, a floating point architecture still necessary, it a pitty, because
I think speex is a very good project. For your info I was able to move the
libmad (MP3 library) on ARM7 this the small amount of memory foot-print
Regards
Paolo
---------- Initial Header -----------
>From : "Ralph Giles" giles@xiph.org
To : "pberna@iol.it" pberna@iol.it
Cc : "speex-dev" speex-dev@xiph.org
Date : Tue, 21 Mar 2006 13:41:41 -0800
Subject : Re: [Speex-dev] ARM7 Speex decoder
> On Tue, Mar 21, 2006 at 09:56:04PM +0100, pberna@iol.it wrote:
>
> > My intention is to read a piece at time of an .ogg file (stored in and
external Multimedia card) decompress it and render it on and LPC2000 DAC.
Because I don't have enough RAM memory to load the complete ogg file, I must
read only a piece of file at certain time, then decompress and render it, and
repeat the previous process until the end of the file. The problem is that I
don't know what is the minimum file block size that I must consider.
>
> What you appear to be missing is that the speex data packets are
> encapsulated in an Ogg container. You must first parse the Ogg
> header to extract the raw packets before passing them to libspeex
> with speex_bits_read_from(). It's not clear from your description
> that your file_read() function is doing all this.
>
> speexdec uses libogg to do this.
>
> Ogg pages produced by the reference encoder are around 4 kB, but
> by specification Ogg pages can be up to 65 kB in length. libogg
> will internally buffer a full page before returning any packet
> data for decode, so that's the minimum footprint you would have
> to design for.
>
> If you're in a memory contrained environment I'd recommend
implementing
> your own ogg parser to pass the data to libspeex directly as it's read
> instead of buffering a whole page for checksum verification. You can
> either compute the checksum incrementally or dispense with it entirely
> and assume libspeex will detect any file corruption. Note that both of
> these are necessarily less robust against damaged files, but it should
> let you process data with an arbitrarily small read buffer.
>
> A compromise would be to use a static 5 kB buffer and verify the crc
> only if the page happens to fit, falling back to incremental parsing
> otherwise.
>
> HTH,
> -r
>