Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/audio/ffmpeg_dec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ else()
if(CONFIG_FFMPEG_DEC_G722 OR CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-g722.c)
endif()
if(CONFIG_FFMPEG_DEC_APTX OR CONFIG_COMP_FFMPEG_DEC_STUB)
if(CONFIG_FFMPEG_DEC_APTX OR CONFIG_FFMPEG_DEC_APTX_HD OR CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-aptx.c)
endif()
if(CONFIG_FFMPEG_DEC_G726 OR CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-g726.c)
endif()
if(CONFIG_FFMPEG_DEC_ALAW OR CONFIG_FFMPEG_DEC_MULAW OR CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-g711.c)
endif()

if(CONFIG_COMP_FFMPEG_DEC_STUB)
add_local_sources(sof ffmpeg_dec-stub.c)
Expand Down Expand Up @@ -58,9 +64,15 @@ else()
if(CONFIG_FFMPEG_ENC_G722)
add_local_sources(sof ffmpeg-enc-g722.c)
endif()
if(CONFIG_FFMPEG_ENC_APTX)
if(CONFIG_FFMPEG_ENC_APTX OR CONFIG_FFMPEG_ENC_APTX_HD)
add_local_sources(sof ffmpeg-enc-aptx.c)
endif()
if(CONFIG_FFMPEG_ENC_G726)
add_local_sources(sof ffmpeg-enc-g726.c)
endif()
if(CONFIG_FFMPEG_ENC_ALAW OR CONFIG_FFMPEG_ENC_MULAW)
add_local_sources(sof ffmpeg-enc-g711.c)
endif()
if(CONFIG_FFMPEG_FILTER)
add_local_sources(sof ffmpeg-filter.c)
endif()
Expand Down Expand Up @@ -102,9 +114,15 @@ else()
if(CONFIG_FFMPEG_ENC_G722)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-g722.c)
endif()
if(CONFIG_FFMPEG_ENC_APTX)
if(CONFIG_FFMPEG_ENC_APTX OR CONFIG_FFMPEG_ENC_APTX_HD)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-aptx.c)
endif()
if(CONFIG_FFMPEG_ENC_G726)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-g726.c)
endif()
if(CONFIG_FFMPEG_ENC_ALAW OR CONFIG_FFMPEG_ENC_MULAW)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-enc-g711.c)
endif()
if(CONFIG_FFMPEG_FILTER)
list(APPEND _ffmpeg_dec_sources ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg-filter.c)
endif()
Expand Down
62 changes: 61 additions & 1 deletion src/audio/ffmpeg_dec/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,36 @@ config FFMPEG_DEC_APTX
--enable-decoder=aptx in the libavcodec build for compress playback
streams requesting SND_AUDIOCODEC_APTX.

config FFMPEG_DEC_APTX_HD
bool "Bluetooth aptX HD decoder"
help
Bluetooth aptX HD 24-bit audio decoder. Pure integer 4-band QMF +
ADPCM decoder with no floating-point math dependency. Enables
--enable-decoder=aptx_hd in the libavcodec build for compress
playback streams requesting SND_AUDIOCODEC_APTX_HD.

config FFMPEG_DEC_G726
bool "ITU-T G.726 ADPCM decoder"
help
ITU-T G.726 ADPCM decoder (16/24/32/40 kbps, big- and little-endian
packing via profile=1). Pure integer ADPCM decoder with no
floating-point math dependency. Enables
--enable-decoder=adpcm_g726,adpcm_g726le in the libavcodec build.

config FFMPEG_DEC_ALAW
bool "ITU-T G.711 A-law decoder"
help
ITU-T G.711 A-law companded PCM decoder. Pure integer table lookup
with no floating-point math dependency. Enables
--enable-decoder=pcm_alaw in the libavcodec build.

config FFMPEG_DEC_MULAW
bool "ITU-T G.711 mu-law decoder"
help
ITU-T G.711 mu-law companded PCM decoder. Pure integer table lookup
with no floating-point math dependency. Enables
--enable-decoder=pcm_mulaw in the libavcodec build.

comment "FFmpeg encoders to build (footprint scales with selection)"

config FFMPEG_ENC_MP3
Expand Down Expand Up @@ -144,11 +174,41 @@ config FFMPEG_ENC_APTX
dependency. Selected at runtime for compress capture streams
requesting SND_AUDIOCODEC_APTX.

config FFMPEG_ENC_APTX_HD
bool "Bluetooth aptX HD encoder (native libavcodec)"
help
Bluetooth aptX HD 24-bit audio encoder via native libavcodec aptx_hd
encoder. Pure integer 4-band QMF + ADPCM encoder with no
floating-point math dependency. Selected at runtime for compress
capture streams requesting SND_AUDIOCODEC_APTX_HD.

config FFMPEG_ENC_G726
bool "ITU-T G.726 ADPCM encoder (native libavcodec)"
help
ITU-T G.726 ADPCM encoder (16/24/32/40 kbps, big- and little-endian
packing via profile=1) via native libavcodec adpcm_g726 /
adpcm_g726le encoders. Pure integer ADPCM with no floating-point math
dependency.

config FFMPEG_ENC_ALAW
bool "ITU-T G.711 A-law encoder (native libavcodec)"
help
ITU-T G.711 A-law companded PCM encoder via native libavcodec
pcm_alaw encoder. Pure integer lookup with no floating-point math
dependency.

config FFMPEG_ENC_MULAW
bool "ITU-T G.711 mu-law encoder (native libavcodec)"
help
ITU-T G.711 mu-law companded PCM encoder via native libavcodec
pcm_mulaw encoder. Pure integer lookup with no floating-point math
dependency.

# Selected automatically when any encoder is enabled. Gates compilation of the
# runtime encode path (ffmpeg-encode.c).
config FFMPEG_ENC
bool
default y if FFMPEG_ENC_MP3 || FFMPEG_ENC_AAC || FFMPEG_ENC_FLAC || FFMPEG_ENC_ALAC || FFMPEG_ENC_SBC || FFMPEG_ENC_G722 || FFMPEG_ENC_APTX
default y if FFMPEG_ENC_MP3 || FFMPEG_ENC_AAC || FFMPEG_ENC_FLAC || FFMPEG_ENC_ALAC || FFMPEG_ENC_SBC || FFMPEG_ENC_G722 || FFMPEG_ENC_APTX || FFMPEG_ENC_APTX_HD || FFMPEG_ENC_G726 || FFMPEG_ENC_ALAW || FFMPEG_ENC_MULAW

comment "FFmpeg audio filters to build (libavfilter)"
depends on IPC_MAJOR_4
Expand Down
25 changes: 22 additions & 3 deletions src/audio/ffmpeg_dec/ffmpeg-enc-aptx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Copyright(c) 2026 Intel Corporation.
//
// Bluetooth aptX per-codec encoder implementation for ffmpeg_dec.
/* Bluetooth aptX / aptX HD per-codec encoder implementation for ffmpeg_dec. */

#include <sof/audio/module_adapter/module/generic.h>
#include <ipc/compress_params.h>
Expand Down Expand Up @@ -46,14 +46,17 @@ static int ffmpeg_enc_aptx_init(struct processing_module *mod, struct ffmpeg_enc
{
struct comp_dev *dev = mod->dev;
struct ffmpeg_enc_aptx_data *aptx;
enum AVCodecID codec_id;

aptx = mod_zalloc(mod, sizeof(*aptx));
if (!aptx)
return -ENOMEM;

aptx->codec = avcodec_find_encoder(AV_CODEC_ID_APTX);
codec_id = (e->codec_ops->id == FFMPEG_DEC_CODEC_APTX_HD) ?
AV_CODEC_ID_APTX_HD : AV_CODEC_ID_APTX;
aptx->codec = avcodec_find_encoder(codec_id);
if (!aptx->codec) {
comp_err(dev, "libavcodec aptX encoder not found");
comp_err(dev, "libavcodec %s encoder not found", e->codec_ops->name);
mod_free(mod, aptx);
return -ENODEV;
}
Expand Down Expand Up @@ -188,6 +191,7 @@ static void ffmpeg_enc_aptx_free(struct processing_module *mod, struct ffmpeg_en
e->codec_priv = NULL;
}

#if defined(CONFIG_FFMPEG_ENC_APTX)
const struct ffmpeg_enc_codec_ops ffmpeg_enc_aptx_ops = {
.id = FFMPEG_DEC_CODEC_APTX,
.snd_codec_id = SND_AUDIOCODEC_APTX,
Expand All @@ -199,3 +203,18 @@ const struct ffmpeg_enc_codec_ops ffmpeg_enc_aptx_ops = {
.reset = ffmpeg_enc_aptx_reset,
.free = ffmpeg_enc_aptx_free,
};
#endif

#if defined(CONFIG_FFMPEG_ENC_APTX_HD)
const struct ffmpeg_enc_codec_ops ffmpeg_enc_aptx_hd_ops = {
.id = FFMPEG_DEC_CODEC_APTX_HD,
.snd_codec_id = SND_AUDIOCODEC_APTX_HD,
.name = "aptx_hd",
.validate_params = ffmpeg_enc_aptx_validate_params,
.init = ffmpeg_enc_aptx_init,
.configure = ffmpeg_enc_aptx_configure,
.encode_frame = ffmpeg_enc_aptx_encode_frame,
.reset = ffmpeg_enc_aptx_reset,
.free = ffmpeg_enc_aptx_free,
};
#endif
Loading
Loading