|
| 1 | +# SPDX-License-Identifier: BSD-3-Clause |
| 2 | + |
| 3 | +config COMP_FFMPEG_DEC |
| 4 | + tristate "FFmpeg (libavcodec) audio decoder" |
| 5 | + select COMP_FFMPEG_DEC_STUB if COMP_STUBS |
| 6 | + help |
| 7 | + Select to include the FFmpeg audio decoder module. It wraps |
| 8 | + libavcodec decoders behind the SOF module interface, decoding a |
| 9 | + compressed elementary stream to PCM. The real backend cross-builds |
| 10 | + libavcodec/libavutil/libswresample from the FFmpeg source pulled in |
| 11 | + by west (see west.yml), enabling only the decoders selected below. |
| 12 | + Without the source (or for CI) select COMP_FFMPEG_DEC_STUB to build |
| 13 | + the dependency-free passthrough stub. |
| 14 | + |
| 15 | +config COMP_FFMPEG_DEC_STUB |
| 16 | + bool "FFmpeg decoder stub backend" |
| 17 | + depends on COMP_FFMPEG_DEC |
| 18 | + help |
| 19 | + Build the ffmpeg_dec module against a dependency-free passthrough |
| 20 | + backend instead of libavcodec. Intended for testing and CI so the |
| 21 | + SOF glue and LLEXT packaging can be validated without the FFmpeg |
| 22 | + source or a cross-built archive. |
| 23 | + |
| 24 | +if COMP_FFMPEG_DEC && !COMP_FFMPEG_DEC_STUB |
| 25 | + |
| 26 | +comment "FFmpeg decoders to build (footprint scales with selection)" |
| 27 | + |
| 28 | +config FFMPEG_DEC_FLAC |
| 29 | + bool "FLAC decoder" |
| 30 | + default y |
| 31 | + help |
| 32 | + Lossless integer decoder. Smallest footprint, no floating-point |
| 33 | + math. Enables --enable-decoder=flac in the libavcodec build. |
| 34 | + |
| 35 | +config FFMPEG_DEC_AAC |
| 36 | + bool "AAC-LC decoder" |
| 37 | + help |
| 38 | + AAC Low Complexity decoder. Pulls in the single-precision float |
| 39 | + math layer (see FFMPEG_DEC_FLOAT_MATH). Enables |
| 40 | + --enable-decoder=aac in the libavcodec build. |
| 41 | + |
| 42 | +config FFMPEG_DEC_OPUS |
| 43 | + bool "Opus decoder" |
| 44 | + help |
| 45 | + Opus (SILK+CELT) decoder. Pulls in the single-precision float math |
| 46 | + layer. Enables --enable-decoder=opus in the libavcodec build. |
| 47 | + |
| 48 | +comment "FFmpeg audio filters (libavfilter; need the avfilter-graph backend to run)" |
| 49 | + |
| 50 | +config FFMPEG_FILTER_AFFTDN |
| 51 | + bool "FFT noise reduction (afftdn)" |
| 52 | + help |
| 53 | + Build FFmpeg's FFT-based denoiser (afftdn) into libavfilter. Pure DSP, |
| 54 | + no external model file (unlike arnndn). Enabling any filter turns on |
| 55 | + libavfilter in the cross-build. NOTE: a filter is only usable at runtime |
| 56 | + once the module gains an avfilter-graph backend; selecting it here just |
| 57 | + builds the filter into the archive. |
| 58 | + |
| 59 | +config FFMPEG_DEC_FILTER_MODE |
| 60 | + bool "Build as a PCM filter effect instead of a decoder [EXPERIMENTAL]" |
| 61 | + select FFMPEG_FILTER_AFFTDN |
| 62 | + help |
| 63 | + Build the module as a PCM source->sink effect that runs an FFmpeg |
| 64 | + audio filter graph (default afftdn noise reduction) via the modern |
| 65 | + .process interface, instead of the compressed-stream decoder. Turns on |
| 66 | + libavfilter and the fast float math. Structurally complete and |
| 67 | + load-ready; real-time latency/format tuning needs on-hardware bring-up. |
| 68 | + |
| 69 | +# Turns on libavfilter in the FFmpeg cross-build when any filter is selected. |
| 70 | +config FFMPEG_BUILD_AVFILTER |
| 71 | + bool |
| 72 | + default y if FFMPEG_FILTER_AFFTDN |
| 73 | + |
| 74 | +# Selected automatically when a decoder or filter that needs IEEE float math is |
| 75 | +# built. Gates compilation of the fast single-precision libm (fastmathf.c). |
| 76 | +config FFMPEG_DEC_FLOAT_MATH |
| 77 | + bool |
| 78 | + default y if FFMPEG_DEC_AAC || FFMPEG_DEC_OPUS || FFMPEG_FILTER_AFFTDN |
| 79 | + |
| 80 | +config FFMPEG_DEC_COLD_SPLIT |
| 81 | + bool "Place cold FFmpeg code (av_cold init/setup) in DRAM [EXPERIMENTAL]" |
| 82 | + depends on COLD_STORE_EXECUTE_DRAM |
| 83 | + default n |
| 84 | + help |
| 85 | + EXPERIMENTAL. Build libavcodec with -mtext-section-literals and rename |
| 86 | + FFmpeg's cold functions (its av_cold init/table-generation code, which GCC |
| 87 | + emits into .text.unlikely) into SOF's .cold section so the LLEXT loader |
| 88 | + places them in DRAM, keeping the hot per-frame decode in fast SRAM. |
| 89 | + |
| 90 | + Measured cold code is small (~1 KB for FLAC, ~26 KB for AAC) because |
| 91 | + FFmpeg only marks init functions av_cold. Placing that much cold code in a |
| 92 | + -shared LLEXT currently hits Xtensa linker limits (cold->hot call8 range |
| 93 | + needs -mlongcalls; the orphan .cold lands at a bad LMA and overlaps .hash), |
| 94 | + so this is off by default pending proper cold-region placement in the LLEXT |
| 95 | + memory map. See git history / TESTING notes. |
| 96 | + |
| 97 | +endif # COMP_FFMPEG_DEC && !COMP_FFMPEG_DEC_STUB |
0 commit comments