Audio: Cadence: Add an open-source PCM decoder#10554
Conversation
|
Good to see this. We supported PCM format with compress interface via src/audio/module_adapter/module/passthrough.c module so far. |
|
@singalsu, can you also update the apps/compr/ README.txt, all_codecs.conf and create a new pcm.conf for convenience? |
17bc853 to
8b58c19
Compare
Actually I didn't know about it, there does not seem topology (v2) for it, but good to know such exists. |
Oh, that's true. We only have it for IPC3. Besides compressed playback there's also an PCM "encoder" for compress capture. sof-imx8mp-compr-pcm-cap-wm8960.m4 |
8b58c19 to
6b7cdf0
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds an in-tree, open-source PCM (WAV) “decoder” that implements the Cadence codec API so compressed-playback plumbing (e.g., tinycompress cplay) can be exercised with WAV/PCM streams.
Changes:
- Introduces a new Cadence-API-compatible PCM passthrough decoder (
xa_pcm_dec) and its public API header. - Wires the PCM decoder into the Cadence module adapter (API table, codec-id mapping, IPC4 configuration hook) and exposes capability via base_fw codec info.
- Adds build/Kconfig toggles and example
app/compr/*.confconfigurations for enabling PCM decode.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/include/sof/audio/module_adapter/module/cadence.h | Adds PCM decoder symbol and a new API ID. |
| src/include/sof/audio/compress_other/pcm_dec/xa_pcm_dec_api.h | New PCM decoder Cadence-style API definitions and error codes. |
| src/audio/module_adapter/module/compress_other/xa_pcm_dec.c | New open-source PCM passthrough “decoder” implementing Cadence API commands. |
| src/audio/module_adapter/module/compress_other/CMakeLists.txt | Builds the PCM decoder source when enabled (non-Zephyr path). |
| src/audio/module_adapter/module/cadence.c | Registers PCM decoder in Cadence API table; maps SND_AUDIOCODEC_PCM; adds sample-count handling. |
| src/audio/module_adapter/module/cadence_ipc4.c | Treats PCM decoder as needing no special IPC4 codec param configuration. |
| src/audio/module_adapter/Kconfig | Adds CONFIG_SOF_COMPRESS_CODEC_PCM_DEC option and help text. |
| src/audio/module_adapter/CMakeLists.txt | Hooks PCM decoder into Zephyr and non-shared builds. |
| src/audio/base_fw.c | Advertises PCM codec capability in IPC4 firmware info when enabled. |
| app/compr/README.txt | Documents new pcm.conf and includes PCM in “all_codecs” list. |
| app/compr/pcm.conf | New sample configuration enabling Cadence + PCM decoder. |
| app/compr/all_codecs.conf | Enables PCM decoder alongside existing Cadence codecs. |
| * size. With a 16 KB input buffer at 48 kHz stereo S16, each full buffer is | ||
| * ~85 ms, so ~12 calls bound the trailing silence to ~1 s. | ||
| */ | ||
| #define PCM_DEC_EOS_FULL_BUF_COUNT 12 |
There was a problem hiding this comment.
Note to reviewers: I could not find a better way to end the stream without losing in the playback small part at the end of the wav file. The mp3 and aac decoders can determine from the mpeg payload that stream is at end while in compress PCM we don't have such information. Other attempts to fix this at host DMA level to looked too invasive and also did not produce a good result. Sometimes the end of e.g. short clips at /usr/share/sounds/alsa was still swallowed and not heard. A proper long term fix to the SOF framework can be done later.
6b7cdf0 to
9a0da05
Compare
| /* copy the produced samples into the output buffer */ | ||
| memcpy_s(output_buffers[0].data, codec->mpd.produced, codec->mpd.out_buff, | ||
| codec->mpd.produced); | ||
| memcpy_s(output_buffers[0].data, codec->mpd.out_buff_size, | ||
| codec->mpd.out_buff, codec->mpd.produced); |
There was a problem hiding this comment.
"Bot is wrong. The current line is correct as-is. No change recommended."
9a0da05 to
ac83bee
Compare
This patch adds a PCM decoder that is compatible with Cadence codec API. It allows to test tinycompress cplay playback with wav format files. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
ac83bee to
c978518
Compare
This patch adds a PCM decoder that is compatible with Cadence codec API. It allows to test tinycompress cplay playback with wav format files.