Skip to content

Commit

Permalink
Tools: Topology2: Add test topology for RTNR
Browse files Browse the repository at this point in the history
Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
singalsu committed Nov 2, 2023
1 parent 5aee071 commit 5491cb3
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tools/topology/topology2/cavs-benchmark-hda.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<include/components/dcblock.conf>
<include/components/rtnr.conf>

Define {
ANALOG_PLAYBACK_PCM 'Analog Playback'
Expand Down Expand Up @@ -284,4 +285,20 @@ IncludeByKey.BENCH_CONFIG {
"gain32" {
<include/bench/gain_s32.conf>
}

#
# RTNR component
#

"rtnr16" {
<include/bench/rtnr_s16.conf>
}

"rtnr24" {
<include/bench/rtnr_s24.conf>
}

"rtnr32" {
<include/bench/rtnr_s32.conf>
}
}
2 changes: 2 additions & 0 deletions tools/topology/topology2/development/tplg-targets-bench.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(components
"eqiir"
"eqfir"
"gain"
"rtnr"
)

set(component_parameters
Expand All @@ -24,6 +25,7 @@ set(component_parameters
"BENCH_EQIIR_PARAMS=highpass_50hz_0db_48khz"
"BENCH_EQFIR_PARAMS=loudness"
"BENCH_GAIN_PARAMS=default"
"BENCH_RTNR_PARAMS=default"
)

set(components_s32
Expand Down
23 changes: 23 additions & 0 deletions tools/topology/topology2/include/bench/rtnr_controls_capture.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Created initially with script "./bench_comp_generate.sh rtnr"
# may need edits to modify controls
Object.Control {
# Un-comment the supported controls in RTNR
bytes."1" {
name '$ANALOG_CAPTURE_PCM RTNR bytes'
IncludeByKey.BENCH_RTNR_PARAMS {
"default" "include/components/rtnr/default_bytes.conf"
}
}
bytes."2" {
name '$ANALOG_CAPTURE_PCM RTNR data'
IncludeByKey.BENCH_RTNR_PARAMS {
"default" "include/components/rtnr/default_data.conf"
}
}
mixer."1" {
name '$ANALOG_CAPTURE_PCM RTNR enable'
}
#enum."1" {
# name '$ANALOG_CAPTURE_PCM RTNR enum'
#}
}
23 changes: 23 additions & 0 deletions tools/topology/topology2/include/bench/rtnr_controls_playback.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Created initially with script "./bench_comp_generate.sh rtnr"
# may need edits to modify controls
Object.Control {
# Un-comment the supported controls in RTNR
bytes."1" {
name '$ANALOG_PLAYBACK_PCM RTNR bytes'
IncludeByKey.BENCH_RTNR_PARAMS {
"default" "include/components/rtnr/default_bytes.conf"
}
}
bytes."2" {
name '$ANALOG_PLAYBACK_PCM RTNR data'
IncludeByKey.BENCH_RTNR_PARAMS {
"default" "include/components/rtnr/default_data.conf"
}
}
mixer."1" {
name '$ANALOG_PLAYBACK_PCM RTNR enable'
}
#enum."1" {
# name '$ANALOG_PLAYBACK_PCM RTNR enum'
#}
}
19 changes: 19 additions & 0 deletions tools/topology/topology2/include/bench/rtnr_hda_route.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Created with script "./bench_comp_generate.sh rtnr"
Object.Base.route [
{
sink 'dai-copier.HDA.$HDA_ANALOG_DAI_NAME.playback'
source 'rtnr.1.1'
}
{
sink 'rtnr.1.1'
source 'host-copier.0.playback'
}
{
source 'dai-copier.HDA.$HDA_ANALOG_DAI_NAME.capture'
sink 'rtnr.3.2'
}
{
source 'rtnr.3.2'
sink 'host-copier.0.capture'
}
]
13 changes: 13 additions & 0 deletions tools/topology/topology2/include/bench/rtnr_s16.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Created with script "./bench_comp_generate.sh rtnr"
Object.Widget.rtnr.1 {
index 1
<include/bench/one_input_output_format_s16.conf>
<include/bench/rtnr_controls_playback.conf>
}
Object.Widget.rtnr.2 {
index 3
<include/bench/one_input_output_format_s16.conf>
<include/bench/rtnr_controls_capture.conf>
}
<include/bench/host_io_gateway_pipelines_s16.conf>
<include/bench/rtnr_hda_route.conf>
13 changes: 13 additions & 0 deletions tools/topology/topology2/include/bench/rtnr_s24.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Created with script "./bench_comp_generate.sh rtnr"
Object.Widget.rtnr.1 {
index 1
<include/bench/one_input_output_format_s24.conf>
<include/bench/rtnr_controls_playback.conf>
}
Object.Widget.rtnr.2 {
index 3
<include/bench/one_input_output_format_s24.conf>
<include/bench/rtnr_controls_capture.conf>
}
<include/bench/host_io_gateway_pipelines_s24.conf>
<include/bench/rtnr_hda_route.conf>
13 changes: 13 additions & 0 deletions tools/topology/topology2/include/bench/rtnr_s32.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Created with script "./bench_comp_generate.sh rtnr"
Object.Widget.rtnr.1 {
index 1
<include/bench/one_input_output_format_s32.conf>
<include/bench/rtnr_controls_playback.conf>
}
Object.Widget.rtnr.2 {
index 3
<include/bench/one_input_output_format_s32.conf>
<include/bench/rtnr_controls_capture.conf>
}
<include/bench/host_io_gateway_pipelines_s32.conf>
<include/bench/rtnr_hda_route.conf>
86 changes: 86 additions & 0 deletions tools/topology/topology2/include/components/rtnr.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#
#
# A generic RTNR component. All attributes defined herein are namespaced
# by alsatplg to "Object.Widget.rtnr.attribute_name"
#
# Usage: this component can be used by declaring in the parent object. i.e.
#
# Object.Widget.rtnr."N" {
# index 1
# }
# }

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

<include/controls/mixer.conf>

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

#
# Unique instance for RTNR 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"
}


# RTNR 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 rtnr
#
# 5c7ca334-e15d-11eb-ba80-0242ac130004
uuid "34:a3:7c:5c:5d:e1:eb:11:ba:80:02:42:ac:13:00:04"
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,13 @@
# Copied and modified for IPC4 from RTNR bytes in
# tools/topology/topology1/sof/pipe-rtnr-google-rtc-audio-processing-capture.m4
# param_id = 0 for SOF_RTNR_CONFIG
Object.Base.data."rtnr_bytes_config" {
bytes "0x53,0x4f,0x46,0x34,0x00,0x00,0x00,0x00,
0x20,0x00,0x00,0x00,0x00,0x30,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x80,0xbb,0x00,0x00,0x00,0x00,0x00,0x00"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copied and modified for IPC4 from RTNR data in
# tools/topology/topology1/sof/pipe-rtnr-google-rtc-audio-processing-capture.m4
# param_id = 1 for SOF_RTNR_DATA
Object.Base.data."rtnr_data_config" {
bytes "0x53,0x4f,0x46,0x34,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x30,0x01,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"
}

0 comments on commit 5491cb3

Please sign in to comment.