Yuh-Chin Chang
2005-Jan-31 04:06 UTC
[Vorbis-dev] Questions regarding OGG implementation on DSP
As to tremor fixed-point implementation, i got several questions, and hopefully some one can help me out. Thanks a lot! 1. For DSP chips with small and limited memory, how much memory do we really need for saving all codebooks before we start to decode audio packets? Can the bit-rate give us some clues? Is there some simple guidelines for this? 2. For CRC error protection, it seems to me that we need to get all the pages, compute the CRC, and then compare the result to the one for that packet. That means a huge input buffer in some cases. So, ignoring the CRC words seems a reasonable compromise for portable devices, since it is anyway a error detection, not correction. We cannot do anything about it except skipping that packet. Is this assumption ok? 3. Any further information/papers/books about how Vorbis gets audio samples compressed? Well, the Vorbis I specification does give me some clues, but not very clear to me. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/vorbis-dev/attachments/20050131/a1a3c6b7/attachment.html
Dominik Kuhlen
2005-Jan-31 10:19 UTC
[Vorbis-dev] Questions regarding OGG implementation on DSP
Hi! On Monday 31 January 2005 13:06, Yuh-Chin Chang wrote:> As to tremor fixed-point implementation, i got several questions, and > hopefully some one can help me out. Thanks a lot! > > 1. For DSP chips with small and limited memory, how much memory do we > really need for saving all codebooks before we start to decode audio > packets? Can the bit-rate give us some clues? Is there some simple > guidelines for this?I just tried this: download svn tremor version. compiled and did 'make example' as well ran: valgrind -v --tool=massif ./ivorbisfile_example < testfile.ogg > /dev/null this has created a very nice "memory usage over time" diagram. in my case the maximum memory usage was abt 140kByte. ogginfo testfile.ogg shows: Vorbis headers parsed for stream 1, information follows... Version: 0 Vendor: Xiph.Org libVorbis I 20040629 Channels: 2 Rate: 44100 Nominal bitrate: 45.000000 kb/s Upper bitrate not set Lower bitrate not set Vorbis stream 1: Total data length: 2236995 bytes Playback length: 6m:19s Average bitrate: 47.157508 kbps Logical stream 1 ended Well, ok, this (valgrind) works only on x86 platforms, but you'll get a feeling which part uses how much memory.> > 2. For CRC error protection, it seems to me that we need to get all the > pages, compute the CRC, and then compare the result to the one for thatYou need one page (i.e. header + all packets) for the crc check> packet. That means a huge input buffer in some cases. So, ignoring the CRCthe reference encoder produces about 4kByte / page, but you cannot assume this is true in general. see libogg: framing.c function ogg_stream_pageout (line ~449)> words seems a reasonable compromise for portable devices, since it is > anyway a error detection, not correction. We cannot do anything about it > except skipping that packet. Is this assumption ok?yes. But if you decode corrupted packets you will probably get some noise (sounds you don't want to) in your output. the memory consumption for one page is much less than for the codebooks.> > 3. Any further information/papers/books about how Vorbis gets audio samples > compressed? Well, the Vorbis I specification does give me some clues, but > not very clear to me.Feel free to ask questions :-) There's very few information about the encoder in written form (or am I wrong?) BTW (a bit off topic): in "ivorbisfile_example.c" line 24+25 #include <vorbis/ivorbiscodec.h> #include <vorbis/ivorbisfile.h> just before compiling a symbolic link is created: ln -fs . vorbis why not changing the example lines to #include <tremor/ivorbiscodec.h> #include <tremor/ivorbisfile.h> and it will compile without "ln -fs" Dominik
Michael Smith
2005-Jan-31 15:10 UTC
[Vorbis-dev] Questions regarding OGG implementation on DSP
On Mon, 31 Jan 2005 20:06:01 +0800, Yuh-Chin Chang <yuhchin@ms63.hinet.net> wrote:> > > As to tremor fixed-point implementation, i got several questions, and > hopefully some one can help me out. > Thanks a lot! > > 1. For DSP chips with small and limited memory, how much memory do we really > need for > saving all codebooks before we start to decode audio packets? Can the > bit-rate give us some clues? > Is there some simple guidelines for this?This depends mostly on what decoder you use. The Tremor-lowmem version is specifically tuned to use as little memory as possible. I believe it typically requires somewhere around 40-60 kB total heap+stack for decoding. It's always possible to create pathological streams that require much more memory, but it's generally considered reasonable for memory-limited devices to refuse to play those.> > 2. For CRC error protection, it seems to me that we need to get all the > pages, compute the CRC, > and then compare the result to the one for that packet. That means a huge > input buffer in some cases. > So, ignoring the CRC words seems a reasonable compromise for portable > devices, > since it is anyway a error detection, not correction. We cannot do anything > about it except skipping that > packet. Is this assumption ok?You only need a single page (NOT a packet), which will typically be approximately 4 kB or less, which is a pretty small fraction of the total memory required. Not reading in the whole page at once would be quite a lot more development effort for very little gain, plus you'd have the disadvantage of not detecting corrupt data.> > 3. Any further information/papers/books about how Vorbis gets audio samples > compressed? > Well, the Vorbis I specification does give me some clues, but not very clear > to me.There's little written about the specific techniques the encoder uses (though there's plenty of information about the general approaches taken in the literature), and the specification only dictates what a decoder needs to do. If you have more specific questions, we should be able to help. Mike