[FEATURE] Add support for compressed playback
Is your feature request related to a problem? Please describe.
We need compressed playback support in SOF. There is a lot of work to be done on both Linux / SOF FW side but we will keep track of all the discussions inside this single Issue.
Describe the solution you'd like
We need to be able to play compressed files through an alsa compressed interface. For tests one can use cplay utility.
Ideally this should be generic enough to be supported on all platforms, but for start we need to implement it on i.MX platforms.
First supported compressed format should be mp3. Then at least the following file formats should be supported: aac, bsac, dab, drm, mp2, sbc.
Linux kernel should take care of loading the decoder binary into DSP address space. Then most of the jobs should be done by the DSP.
One the SOF Firmware side:
- we need a special type of component which in preliminary discussions we named it module.
- module component should have a processing function, decodeFrame
We need to decide on an interface. We can start with the interface provided by Tensilica by their binary algorithms.
Challenges:
- dynamically loading the decoder algorithm?
- need to investigate the compress API
- for start the decoder algorithm can be 'stitched' after the SOF FW binary. Linux kernel knows how to parse this and load all modules.
- how do we call into algorithm interface? (@dbaluta will revive discussion with Tensilica about headers license)
- one input mp3 frames can result in a variable length decoded pcm data
Cc: @TangleZ @TE-N-ShengjiuWang
@dbaluta you shoud probably add more details here, the mention of 'aac, bsac, dab, drm, mp2" hints at digital radio usages that are very different from the media playback. There may be missing frames (which somewhat breaks the elementary stream approach used by ALSA PCM and compressed APIs) and/or a need for error concealment that adds more constraints on the host/dsp communication and the DSP implementations.
@plbossart sure will try to enhance the feature description. I'm not very familiar with codecs myself, I only dug a little bit in the internals of mp3.
@tangleZ @TE-N-ShengjiuWang maybe you can add more details about the 'aac, bsac, dab, drm, mp2' codecs and their specifics. Did we encounter any specific issues when implementing the memory to memory decoding.
One thing that we need to notice is that common API for all codecs is very important, which make the codecs be easier to be integrated. Another thing is the error handling, different codec has a different error handling, it it better to unify them.
@dbaluta Thanks a lot for working on this feature. Can you list out what all is remaining to get this feature working on SOF? We would definitely like to use this feature and can help.
This was implemented.