Skip to content

audio: ffmpeg_dec: add standalone Vorbis decoder and Opus encoder LLEXTs + Ogg Opus demux - #11561

Draft
lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/ffmpeg-tier2
Draft

lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/ffmpeg-tier2

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Summary

Adds standalone per-codec LLEXT support for Vorbis decoding and Opus encoding, along with shared incremental Ogg page/packet framing and Ogg Opus demuxing in ffmpeg_dec:

  • Shared Ogg Framing (ffmpeg_dec-ogg.c, ffmpeg_dec-ogg.h):
    • Incremental Ogg page/packet demuxer and Ogg page muxer linked only into ffmpeg_dec_opus, ffmpeg_dec_vorbis, and ffmpeg_enc_opus.
    • Added optional extract_packet, reset, and free hooks to struct ffmpeg_dec_codec_ops so non-Ogg standalone decoder LLEXTs do not reference Ogg symbols.
  • Ogg Opus Demux (ffmpeg_dec-opus.c):
    • Detects OggS streams, parses OpusHead/OpusTags headers, stages OpusHead as extradata, and extracts Ogg Opus packets via ffmpeg_dec_ogg_extract_packet(), while leaving raw/unframed Opus on the normal parser path.
  • Vorbis Decoder (CONFIG_FFMPEG_DEC_VORBIS, ffmpeg_dec_vorbis, UUID 1208cd52-7a82-4d71-b903-7346fbf64156):
    • Standalone USE_FASTMATH LLEXT with MAX_EXTRADATA 16384 (configurable FFMPEG_MOD_MAX_EXTRADATA) to hold Vorbis ID, canonical comment, and codebook setup headers, plus built-in heap bump (768 KB).
  • Opus Encoder (CONFIG_FFMPEG_ENC_OPUS, ffmpeg_enc_opus, UUID 857d55e7-8b6b-4e3d-a6fb-91b78c928607):
    • Standalone USE_FASTMATH LLEXT supporting raw and Ogg-encapsulated Opus (OpusHead + OpusTags + audio pages) with supports_mono_downmix = true and libavcodec/opus/enc_psy.c mono/stereo fix.
  • CMake & Topology2:
    • Fixed _ffmpeg_add_decoder / _ffmpeg_add_encoder macro src_files list expansion in llext/CMakeLists.txt so multi-source LLEXTs link all per-codec sources cleanly.
    • Added vorbis decode and opus encode UUIDs and target definitions in compr-ffmpeg.conf, compr-capture-ffmpeg.conf, and tplg-targets.cmake.

Commit

  • 61797a2f0 ffmpeg_dec: add standalone Vorbis decoder and Opus encoder LLEXTs + Ogg Opus demux

Testing

  • PTL standalone LLEXT build (intel_adsp/ace30/ptl, CONFIG_COMP_FFMPEG_DEC=m, -DEXTRA_CFLAGS='-Werror', CONFIG_COMP_BT_CODEC=n locally due to absent liblc3): passed; verified .sof_codec_info and zero undefined FFmpeg/Ogg symbols in ffmpeg_dec_opus.llext (696K), ffmpeg_dec_vorbis.llext (602K), and ffmpeg_enc_opus.llext (592K).
  • PTL stub LLEXT build (CONFIG_COMP_FFMPEG_DEC=m, CONFIG_COMP_FFMPEG_DEC_STUB=y, -DEXTRA_CFLAGS='-Werror'): passed (ffmpeg_dec.llext 26K).
  • PTL built-in build (CONFIG_COMP_FFMPEG_DEC=y, -DEXTRA_CFLAGS='-Werror'): passed.
  • Style & includes: zephyr/scripts/checkpatch.pl --no-tree --max-line-length=100 (0 errors, 0 warnings across 1656 lines) and scripts/check_kernel_includes.py --sources --strict (0 violations).
  • Pending: Topology2 CI build (24000 rate support required in alsatplg/alsa-lib) and PTL hardware audio verification.

…gg Opus demux

Rebase Vorbis decode, Opus encode, and shared Ogg framing onto main's
per-codec standalone LLEXT architecture:

- Add shared incremental Ogg page/packet demuxer and Ogg page muxer
  (ffmpeg_dec-ogg.c/.h) linked only into the Opus and Vorbis decoder
  and Opus encoder LLEXTs via per-codec hooks (extract_packet/reset/free).
- Add Ogg Opus stream detection (OpusHead/OpusTags header stripping and
  extradata staging) to ffmpeg_dec-opus.c while keeping raw Opus working.
- Port Vorbis decoder (ffmpeg_dec_vorbis, UUID 1208cd52-7a82-4d71-b903-7346fbf64156)
  to standalone LLEXT with FFMPEG_MOD_MAX_EXTRADATA=16384 for Vorbis setup headers.
- Port Opus encoder (ffmpeg_enc_opus, UUID 857d55e7-8b6b-4e3d-a6fb-91b78c928607)
  to standalone LLEXT (CELT/PVQ + Ogg encapsulation) with FFmpeg enc_psy mono/stereo fix.
- Update Kconfig, built-in CMakeLists, LLEXT macro list handling, and
  topology2 compr configs/targets for Vorbis decode and Opus encode.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants