Efika 5200B Project
Reggae on Efikain category Multimedia
proposed by Grzegorz Kraszewski on 21st February 2006 (accepted on 20th March 2006)
Project Summary
Porting Reggae to MorphOS on Efika. As Reggae is designed to be effective and has very low memory footprint, it perfectly fits Efika.Project Blog Entries
posted by Grzegorz Kraszewski on 1st October 2011As PowerDeveloper.org is now more focused on ARM architecture and Linux, I've decided to blog about my MorphOS related activity on my
personal blog. I can be also found on Facebook, as well as on irc.freenode.net, channel #morphos. Reggae project is still active. Ports of MorphOS to PowerPC based older Apple hardware, made Efika significancy a bit lower however.
posted by Grzegorz Kraszewski on 21st November 2009While most of my time is now occupied with
DigiBooster 3, Reggae is still developed. I plan to release a "big pack" with all the newest classes, documentation and examples. In the meantime I've started
a series of tutorials for programmers using Reggae in their applications. Reggae itself has got some new clases as well, for example MPEG-I audio demuxer and decoder, and demuxer for ID3 tags. Another new thing in Reggae is support framework for extracting metadata from files (id3tag.demuxer is the first class to use it). I will write more about it in my following blogs here. By the way, you can trace my daily programming activity on
Twitter.
Improvements in multimedia.class
posted by Grzegorz Kraszewski on 28th May 2009
In any object oriented framework there are some routine tasks performed inside methods. These include argument verification, object locking, generating log messages and so on. If possible, these tasks should be performed by the master class, so subclasses implementors are not bothered with them. Reggae is no exception and I decided to move the boring parts of MMM_Pull() method to multimedia.class. I've added two new methods: MMM_PrePull() and MMM_PostPull(), which rather obvious names. Using these methods a subclass implementor (it may be any subclass using MMM_Pull, so a demultiplexer, decoder or filter) may concentrate on data processing and leave bookkeeping for multimedia.class. Advantages of this approach are: avoiding code duplication, standarization of logging and avoiding trivial bugs in subclasses (like locking object with no matching unlock). It is worth noting, the technique is fully backward compatible, all old classes continue to work. The first class adapted to the new style is new zxscreen.decoder. Updated multimedia.class 52.13 will be released soon, classes will adopt this new technique incrementally. I also plan to implement similar wrappers to MMM_Seek() and other methods, which may be simplified this way.
A new audio demultiplexer
posted by Grzegorz Kraszewski on 25th May 2009AMOS was a very popular programming language for Amiga. Inheriting BASIC syntax, it had a lot of multimedia extensions allowing to gather all Amiga powers in easy way. Multimedia data used by AMOS programs were stored with special files called AMOS banks. There was of course AMOS bank subformat for sounds. Sounds were stored as 8-bit PCM. Why not write a Reggae demultiplexer for it? Because samples are stored as PCM, there is no need for a decoder, audiopcm.decoder can handle the stream. What is interesting, such a sound bank can (and usually does) contain many sounds. Reggae handles it with its normal way - creating multiple outputs in a demuxer object, one for each sound. It is the first audio demultiplexer handling multiple sounds in a stream. It raises some problems, for example handling random play and seek in multiple sounds. I've implemented it with seeking the source stream, or (if the source is not seekable) just buffering data in memory. Released just today on
MorphOS Files.
posted by Grzegorz Kraszewski on 24th May 2009It looks like my work on Reggae is not systematical but happens in "bursts" of activity, with long breaks between them. The latest burst happened this month. I've fixed a long standing bug in
audio.output. It has been a bug in initialization code, causing the class to crash if audio hardware couldn't be allocated. I also have extended an ezoteric
zxscreen.demuxer with some even more ezoteric formats. The last achievement is localization of
MediaLogger. Not very much of it, but I'm also busy learning Blender, writing
DigiBooster 3 and programming and maintaining
MorphOS Files. Of course I could blog about these activities too, but do not want to make offtopic posts.
posted by Grzegorz Kraszewski on 6th August 2008
aiff.demuxer has been revisited lately. Now it not only handles uncompressed AIFF files, but also AIFC. I've been sent some AIFC file which seemed to be uncompressed. It uses 'sowt' codec, which is not really a codec. It is just a clever way Apple invented to store little-endian samples. Seems to be used in x86 Mac OS X.
As audiopcm.decoder handles 16, 24 and 32-bit little endian streams already, there was not much work to do. However I've redesigned IFF chunk parser and moved it into a separate linklib. Its flexible design allows me to use it not only for IFF files, but also RIFF (with 64-bit extension) and other chunk-based formats like PNG. Then I've just added parsing of FVER chunk and extended COMM chunk. Now I can handle any AIFC codec assuming I have a decoder class. For 'sowt' a decoder has been ready, and it works flawlessly.
posted by Grzegorz Kraszewski on 25th July 2008
Finally it is the time for looking at audio resampling more seriously. I'm starting for a simplest case - a decimator. Decimation is dividing the sampling frequency by an integer number M. It is done with a lowpass FIR filter with cutoff frequency at pi/M, calculating only every M-th output sample.
I've researched FIR-s optimization already, but this one is a special case. The data reusability (which is critical for SIMD performance) is lower, because of sample skipping. A filter coefficients table is shifted over the input vector not one sample at a time, but M samples.
I've implemented naive reference code today, and did some benchmarking. The reference code is slow, Pegasos 2 achieves 175 to 195 Mtaps/s depending on filter length and decimation factor M. Efika does 55 to 65 Mtaps/s. It needs optimization badly :-).
posted by Grzegorz Kraszewski on 16th May 2008As the site does not provide links to view archived blog entries, I've prepared an
archive with all the blog entries linked using permanent links. I also have the contents stored locally, will probably make it public as well, for easier browsing.
Resampling filters design
posted by Grzegorz Kraszewski on 13th May 2008
I've designed -60 dB and -80 dB resampling filters today. The first one is 48-tap one (and more when downsampling), is oversampled 32 times, so the half-width table has 768 coefficents. The second, high quality one is 64-tap and is oversampled 128 times, which yields 4096 coefficents in the table. Both filters have 3 dB attenuation at 0.45 of sampling frequency and respectively -60 or -80 dB at 0.5 of sampling frequency. I've also made siginficant progress on resampler reference (not optimized at all) code, but it is not yet finished.
audio.output progress, audio resampling
posted by Grzegorz Kraszewski on 12th May 2008I've done some more work on new
audio.output class version. It has a complete subthread framework including command passing. The thread opens AHI, in case of failure, object fails gracefully as it should, with error reported.
I've also started work on a variable rate audio resampler. It uses bandlimited resampling concept
described by J. O. Smith. I've started from designing three resample filters, for three levels of quality. The first, low quality filter is ready. It has 257 coefficents in total and spans over 32 input samples (if no scaling is used). The filter ensures both aliasing distortions and filter interpolation distortions are kept below -40 dB.