Skip to content

Commit

Permalink
Tools: Topology2: Add Multiband-DRC
Browse files Browse the repository at this point in the history
This patch adds the topology2 files for multiband-DRC. The EFX
processing chain is gain - IIR - FIR - DRC or Multiband-DRC. The
DRC selection is done with macro EFX_DRC_COMPONENT and values
"singleband" and "multiband".

The multiband-drc has two ALSA controls, bytes and switch. The
switch control switches the processing on and off.

The generated topology files with multiband-drc are:

sof-hda-efx-mbdrc-generic.tplg
sof-hda-efx-mbdrc-generic-2ch.tplg
sof-hda-efx-mbdrc-generic-4cg.tplg

The topology files with DRC are as before:

sof-hda-efx-mbdrc-generic.tplg
sof-hda-efx-mbdrc-generic-2ch.tplg
sof-hda-efx-mbdrc-generic-4cg.tplg

The configuration blob default is updated to what is generated
by the current example_multiband_drc.m configuration script. The
pass-through blob is set as default for tplg2. The topology 1
blobs are updated similarly.

Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
singalsu committed Aug 25, 2023
1 parent 7a77c50 commit d1a7471
Show file tree
Hide file tree
Showing 9 changed files with 550 additions and 50 deletions.
165 changes: 116 additions & 49 deletions tools/topology/topology2/cavs-mixin-mixout-efx-hda.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,81 @@ Object.Dai.HDA [
]

Object.Pipeline {
mixout-gain-efx-dai-copier-playback [
{
index 2
IncludeByKey.EFX_DRC_COMPONENT {
"singleband" {
mixout-gain-efx-dai-copier-playback [
{
index 2

Object.Widget.dai-copier.1 {
node_type $HDA_LINK_OUTPUT_CLASS
stream_name $HDA_ANALOG_DAI_NAME
dai_type "HDA"
copier_type "HDA"
}
Object.Widget.gain.1 {
Object.Control.mixer.1 {
name 'Post Mixer $ANALOG_PLAYBACK_PCM Volume'
}
}
Object.Widget.eqiir.1 {
Object.Control.bytes."1" {
name 'Post Mixer $ANALOG_PLAYBACK_PCM IIR Eq'
}
}
Object.Widget.eqfir.1 {
Object.Control.bytes."1" {
name 'Post Mixer $ANALOG_PLAYBACK_PCM FIR Eq'
}
}
Object.Widget.drc.1 {
Object.Control.bytes."1" {
name '2 Main playback DRC'
}
}
}
]
Object.Widget.dai-copier.1 {
node_type $HDA_LINK_OUTPUT_CLASS
stream_name $HDA_ANALOG_DAI_NAME
dai_type "HDA"
copier_type "HDA"
}
Object.Widget.gain.1 {
Object.Control.mixer.1 {
name 'Post Mixer $ANALOG_PLAYBACK_PCM Volume'
}
}
Object.Widget.eqiir.1 {
Object.Control.bytes."1" {
name 'Post Mixer $ANALOG_PLAYBACK_PCM IIR Eq'
}
}
Object.Widget.eqfir.1 {
Object.Control.bytes."1" {
name 'Post Mixer $ANALOG_PLAYBACK_PCM FIR Eq'
}
}
Object.Widget.drc.1 {
Object.Control.bytes."1" {
name 'Post Mixer $ANALOG_PLAYBACK_PCM DRC'
}
}
}
]
}
"multiband" {
mixout-gain-efx-mbdrc-dai-copier-playback [
{
index 2

Object.Widget.dai-copier.1 {
node_type $HDA_LINK_OUTPUT_CLASS
stream_name $HDA_ANALOG_DAI_NAME
dai_type "HDA"
copier_type "HDA"
}
Object.Widget.gain.1 {
Object.Control.mixer.1 {
name 'Post Mixer $ANALOG_PLAYBACK_PCM Volume'
}
}
Object.Widget.eqiir.1 {
Object.Control.bytes."1" {
name 'Post Mixer $ANALOG_PLAYBACK_PCM IIR Eq'
}
}
Object.Widget.eqfir.1 {
Object.Control.bytes."1" {
name 'Post Mixer $ANALOG_PLAYBACK_PCM FIR Eq'
}
}
Object.Widget.multiband_drc.1 {
Object.Control {
bytes."1" {
name 'Post Mixer $ANALOG_PLAYBACK_PCM MBDRC bytes'
}
mixer."1" {
name 'Post Mixer $ANALOG_PLAYBACK_PCM MBDRC switch'
}
}
}
}
]
}
}

host-copier-gain-mixin-playback [
{
Expand Down Expand Up @@ -140,21 +183,45 @@ Object.PCM.pcm [
]

# top-level pipeline connections
Object.Base.route [
{
sink 'dai-copier.HDA.$HDA_ANALOG_DAI_NAME.playback'
source 'drc.2.1'
}
{
source 'mixin.1.1'
sink 'mixout.2.1'
}
{
source 'dai-copier.HDA.$HDA_ANALOG_DAI_NAME.capture'
sink 'host-copier.0.capture'
}
{
source 'host-copier.0.playback'
sink 'gain.1.1'
}
]
IncludeByKey.EFX_DRC_COMPONENT {
"singleband" {
Object.Base.route [
{
sink 'dai-copier.HDA.$HDA_ANALOG_DAI_NAME.playback'
source 'drc.2.1'
}
{
source 'mixin.1.1'
sink 'mixout.2.1'
}
{
source 'dai-copier.HDA.$HDA_ANALOG_DAI_NAME.capture'
sink 'host-copier.0.capture'
}
{
source 'host-copier.0.playback'
sink 'gain.1.1'
}
]
}
"multiband" {
Object.Base.route [
{
sink 'dai-copier.HDA.$HDA_ANALOG_DAI_NAME.playback'
source 'multiband_drc.2.1'
}
{
source 'mixin.1.1'
sink 'mixout.2.1'
}
{
source 'dai-copier.HDA.$HDA_ANALOG_DAI_NAME.capture'
sink 'host-copier.0.capture'
}
{
source 'host-copier.0.playback'
sink 'gain.1.1'
}
]
}
}
16 changes: 16 additions & 0 deletions tools/topology/topology2/development/tplg-targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@ PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-hda-efx-generic-4ch.bin,USE_CHAIN_DMA=
DEEPBUFFER_FW_DMA_MS=100,EFX_FIR_PARAMS=passthrough,EFX_IIR_PARAMS=passthrough,\
EFX_DRC_PARAMS=passthrough"

"sof-hda-generic\;sof-hda-efx-mbdrc-generic\;\
HDA_CONFIG=efx,USE_CHAIN_DMA=true,DEEPBUFFER_FW_DMA_MS=100,\
EFX_FIR_PARAMS=passthrough,EFX_IIR_PARAMS=passthrough,\
EFX_DRC_COMPONENT=multiband,EFX_MBDRC_PARAMS=passthrough"

"sof-hda-generic\;sof-hda-efx-mbdrc-generic-2ch\;\
HDA_CONFIG=efx,NUM_DMICS=2,PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-hda-fir-generic-2ch.bin,\
USE_CHAIN_DMA=true,DEEPBUFFER_FW_DMA_MS=100,EFX_FIR_PARAMS=passthrough,EFX_IIR_PARAMS=passthrough,\
EFX_DRC_COMPONENT=multiband,EFX_MBDRC_PARAMS=passthrough"

"sof-hda-generic\;sof-hda-efx-mbdrc-generic-4ch\;\
HDA_CONFIG=efx,NUM_DMICS=4,PDM1_MIC_A_ENABLE=1,PDM1_MIC_B_ENABLE=1,\
PREPROCESS_PLUGINS=nhlt,NHLT_BIN=nhlt-sof-hda-efx-generic-4ch.bin,USE_CHAIN_DMA=true,\
DEEPBUFFER_FW_DMA_MS=100,EFX_FIR_PARAMS=passthrough,EFX_IIR_PARAMS=passthrough,\
EFX_DRC_COMPONENT=multiband,EFX_MBDRC_PARAMS=passthrough"

# CAVS HDA topology with gain and SRC before mixin for HDA and passthrough pipelines for HDMI
"sof-hda-generic\;sof-hda-src-generic\;HDA_CONFIG=src,USE_CHAIN_DMA=true,DEEPBUFFER_FW_DMA_MS=100"

Expand Down
85 changes: 85 additions & 0 deletions tools/topology/topology2/include/components/multiband_drc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#
#
# A generic MULTIBAND_DRC component. All attributes defined herein are namespaced
# by alsatplg to "Object.Widget.multiband_drc.attribute_name"
#
# Usage: this component can be used by declaring in the parent object. i.e.
#
# Object.Widget.multiband_drc."N" {
# index 1
# }
# }

#
# Where M is pipeline ID and N is a unique integer in the parent object.

Class.Widget."multiband_drc" {
#
# Pipeline ID
#
DefineAttribute."index" {
type "integer"
}

#
# Unique instance for MULTIBAND_DRC widget
#
DefineAttribute."instance" {
type "integer"
}

# Include common widget attributes definition
<include/components/widget-common.conf>

attributes {
!constructor [
"index"
"instance"
]
!mandatory [
"num_input_pins"
"num_output_pins"
"num_input_audio_formats"
"num_output_audio_formats"
]

!immutable [
"uuid"
"type"
]
!deprecated [
"preload_count"
]
unique "instance"
}

#
# multiband_drc widget switch control
#
Object.Control {
mixer."1" {
Object.Base.channel.1 {
name "fc"
shift 0
}
Object.Base.ops.1 {
name "ctl"
info "volsw"
#259 binds the mixer control to switch get/put handlers
get 259
put 259
}
max 1
}
}

#
# Default attributes for multiband_drc
#

uuid "56:22:9f:0d:4f:8e:b3:47:84:48:23:9a:33:4f:11:91"
type "effect"
no_pm "true"
num_input_pins 1
num_output_pins 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Exported Control Bytes 16-Aug-2023
Object.Base.data."multiband_drc_config" {
bytes "
0x53,0x4f,0x46,0x34,0x00,0x00,0x00,0x00,
0x4c,0x02,0x00,0x00,0x00,0xa0,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x4c,0x02,0x00,0x00,0x03,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x7b,0x8e,0x88,0xfe,
0x36,0x79,0x57,0x17,0x5f,0x19,0x6f,0x06,
0xe8,0x79,0x67,0xd4,0x00,0x00,0x00,0x40,
0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,
0x5f,0x6d,0x19,0xe7,0x39,0xc4,0xd4,0x50,
0x0c,0x9b,0x09,0x24,0xad,0x76,0x82,0x9f,
0x00,0x00,0x00,0x40,0xff,0xff,0xff,0xff,
0x43,0x72,0x00,0x00,0xa1,0xe6,0x90,0xf9,
0x18,0x86,0x98,0x2b,0xe3,0x32,0xef,0x00,
0x4b,0xf7,0x20,0xf1,0x18,0x69,0xc6,0x28,
0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,
0xf4,0x64,0xf6,0xdb,0x53,0x89,0x7d,0x60,
0x5c,0x14,0xf2,0x0a,0x84,0x0d,0x78,0xdc,
0xda,0xef,0x21,0x1c,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x6f,0x82,0x53,0xc2,
0x3e,0x77,0xa1,0x7d,0x95,0xc1,0x02,0x00,
0x2a,0x83,0x05,0x00,0x95,0xc1,0x02,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,
0x6f,0x82,0x53,0xc2,0x3e,0x77,0xa1,0x7d,
0x34,0x7d,0xd3,0x3e,0x99,0x05,0x59,0x82,
0x34,0x7d,0xd3,0x3e,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x2d,0x3a,0xcd,0xd3,
0xc0,0xf5,0x82,0x68,0x05,0xf4,0xeb,0x00,
0x0a,0xe8,0xd7,0x01,0x05,0xf4,0xeb,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,
0x2d,0x3a,0xcd,0xd3,0xc0,0xf5,0x82,0x68,
0xe5,0x6e,0x2d,0x35,0x36,0x22,0xa5,0x95,
0xe5,0x6e,0x2d,0x35,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x2d,0x3a,0xcd,0xd3,
0xc0,0xf5,0x82,0x68,0x05,0xf4,0xeb,0x00,
0x0a,0xe8,0xd7,0x01,0x05,0xf4,0xeb,0x00,
0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,
0x2d,0x3a,0xcd,0xd3,0xc0,0xf5,0x82,0x68,
0xe5,0x6e,0x2d,0x35,0x36,0x22,0xa5,0x95,
0xe5,0x6e,0x2d,0x35,0x00,0x00,0x00,0x00,
0x00,0x40,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0xe8,0x00,0x00,0x00,0x1e,
0x00,0x00,0x00,0x0c,0xd3,0x4d,0x62,0x00,
0xb1,0xc2,0x09,0x04,0x55,0x55,0x55,0x05,
0x50,0xfa,0x1e,0x00,0x55,0x60,0x94,0x00,
0x7e,0x98,0x6a,0xff,0x83,0xc9,0xfe,0x01,
0x64,0x47,0x47,0x22,0x17,0x56,0x74,0x01,
0x1c,0xc7,0x71,0x00,0x77,0x77,0x77,0xff,
0xd8,0x77,0x1f,0x00,0x05,0x00,0x00,0x00,
0x00,0x00,0x36,0x00,0xdf,0x97,0x03,0x00,
0xe7,0x3e,0x1e,0x00,0xdf,0x97,0x07,0x00,
0x5b,0x91,0x00,0x00,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0xe8,0x00,0x00,0x00,0x1e,
0x00,0x00,0x00,0x0c,0xd3,0x4d,0x62,0x00,
0xb1,0xc2,0x09,0x04,0x55,0x55,0x55,0x05,
0x50,0xfa,0x1e,0x00,0x55,0x60,0x94,0x00,
0x7e,0x98,0x6a,0xff,0x83,0xc9,0xfe,0x01,
0x64,0x47,0x47,0x22,0x17,0x56,0x74,0x01,
0x1c,0xc7,0x71,0x00,0x77,0x77,0x77,0xff,
0xd8,0x77,0x1f,0x00,0x05,0x00,0x00,0x00,
0x00,0x00,0x36,0x00,0xdf,0x97,0x03,0x00,
0xe7,0x3e,0x1e,0x00,0xdf,0x97,0x07,0x00,
0x5b,0x91,0x00,0x00,0x03,0x00,0x00,0x00,
0x00,0x00,0x00,0xe8,0x00,0x00,0x00,0x1e,
0x00,0x00,0x00,0x0c,0xd3,0x4d,0x62,0x00,
0xb1,0xc2,0x09,0x04,0x55,0x55,0x55,0x05,
0x50,0xfa,0x1e,0x00,0x55,0x60,0x94,0x00,
0x7e,0x98,0x6a,0xff,0x83,0xc9,0xfe,0x01,
0x64,0x47,0x47,0x22,0x17,0x56,0x74,0x01,
0x1c,0xc7,0x71,0x00,0x77,0x77,0x77,0xff,
0xd8,0x77,0x1f,0x00,0x05,0x00,0x00,0x00,
0x00,0x00,0x36,0x00,0xdf,0x97,0x03,0x00,
0xe7,0x3e,0x1e,0x00,0xdf,0x97,0x07,0x00,
0x5b,0x91,0x00,0x00"
}
Loading

0 comments on commit d1a7471

Please sign in to comment.