diff --git a/tools/test/topology/tplg-build.sh b/tools/test/topology/tplg-build.sh index cc343be68..9f7bab822 100755 --- a/tools/test/topology/tplg-build.sh +++ b/tools/test/topology/tplg-build.sh @@ -227,7 +227,7 @@ done # for processing algorithms -ALG_SINGLE_MODE_TESTS=(asrc eq-fir eq-iir src dcblock tdfb drc) +ALG_SINGLE_MODE_TESTS=(asrc eq-fir eq-iir src dcblock tdfb drc multiband-drc) ALG_SINGLE_SIMPLE_TESTS=(test-capture test-playback) ALG_MULTI_MODE_TESTS=(crossover) ALG_MULTI_SIMPLE_TESTS=(test-playback) diff --git a/tools/topology/m4/multiband_drc.m4 b/tools/topology/m4/multiband_drc.m4 new file mode 100644 index 000000000..031f5e05d --- /dev/null +++ b/tools/topology/m4/multiband_drc.m4 @@ -0,0 +1,65 @@ +divert(-1) + +dnl Define macro for Multiband DRC widget +DECLARE_SOF_RT_UUID("multiband_drc", multiband_drc_uuid, 0x0d9f2256, 0x8e4f, 0x47b3, + 0x84, 0x48, 0x23, 0x9a, 0x33, 0x4f, 0x11, 0x91); + +dnl N_MULTIBAND_DRC(name) +define(`N_MULTIBAND_DRC', `MULTIBAND_DRC'PIPELINE_ID`.'$1) + +dnl W_MULTIBAND_DRC(name, format, periods_sink, periods_source, core, kcontrol_list) +define(`W_MULTIBAND_DRC', +`SectionVendorTuples."'N_MULTIBAND_DRC($1)`_tuples_uuid" {' +` tokens "sof_comp_tokens"' +` tuples."uuid" {' +` SOF_TKN_COMP_UUID' STR(multiband_drc_uuid) +` }' +`}' +`SectionData."'N_MULTIBAND_DRC($1)`_data_uuid" {' +` tuples "'N_MULTIBAND_DRC($1)`_tuples_uuid"' +`}' +`SectionVendorTuples."'N_MULTIBAND_DRC($1)`_tuples_w" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4) +` SOF_TKN_COMP_CORE_ID' STR($5) +` }' +`}' +`SectionData."'N_MULTIBAND_DRC($1)`_data_w" {' +` tuples "'N_MULTIBAND_DRC($1)`_tuples_w"' +`}' +`SectionVendorTuples."'N_MULTIBAND_DRC($1)`_tuples_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($2) +` }' +`}' +`SectionData."'N_MULTIBAND_DRC($1)`_data_str" {' +` tuples "'N_MULTIBAND_DRC($1)`_tuples_str"' +`}' +`SectionVendorTuples."'N_MULTIBAND_DRC($1)`_tuples_str_type" {' +` tokens "sof_process_tokens"' +` tuples."string" {' +` SOF_TKN_PROCESS_TYPE' "MULTIBAND_DRC" +` }' +`}' +`SectionData."'N_MULTIBAND_DRC($1)`_data_str_type" {' +` tuples "'N_MULTIBAND_DRC($1)`_tuples_str_type"' +`}' +`SectionWidget."'N_MULTIBAND_DRC($1)`" {' +` index "'PIPELINE_ID`"' +` type "effect"' +` no_pm "true"' +` data [' +` "'N_MULTIBAND_DRC($1)`_data_uuid"' +` "'N_MULTIBAND_DRC($1)`_data_w"' +` "'N_MULTIBAND_DRC($1)`_data_str"' +` "'N_MULTIBAND_DRC($1)`_data_str_type"' +` ]' +` bytes [' + $6 +` ]' +`}') + +divert(0)dnl diff --git a/tools/topology/m4/multiband_drc_coef_default.m4 b/tools/topology/m4/multiband_drc_coef_default.m4 new file mode 100644 index 000000000..d6df36639 --- /dev/null +++ b/tools/topology/m4/multiband_drc_coef_default.m4 @@ -0,0 +1,81 @@ +# Exported Control Bytes 15-Dec-2020 +CONTROLBYTES_PRIV(MULTIBAND_DRC_priv, +` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,' +` 0x4c,0x02,0x00,0x00,0x01,0x20,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,0x42,0xa6,0xbf,0xcc,' +` 0x61,0x1a,0xd5,0x71,0xd7,0xcf,0x5a,0x00,' +` 0xaf,0x9f,0xb5,0x00,0xd7,0xcf,0x5a,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,' +` 0x42,0xa6,0xbf,0xcc,0x61,0x1a,0xd5,0x71,' +` 0x08,0x5d,0x45,0x39,0xf0,0x45,0x75,0x8d,' +` 0x08,0x5d,0x45,0x39,0x00,0x00,0x00,0x00,' +` 0x00,0x40,0x00,0x00,0x42,0xa6,0xbf,0xcc,' +` 0x61,0x1a,0xd5,0x71,0xd7,0xcf,0x5a,0x00,' +` 0xaf,0x9f,0xb5,0x00,0xd7,0xcf,0x5a,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,' +` 0x42,0xa6,0xbf,0xcc,0x61,0x1a,0xd5,0x71,' +` 0x08,0x5d,0x45,0x39,0xf0,0x45,0x75,0x8d,' +` 0x08,0x5d,0x45,0x39,0x00,0x00,0x00,0x00,' +` 0x00,0x40,0x00,0x00,0x01,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0xe3,0x00,0x00,0x00,0x03,' +` 0xdf,0x4f,0xad,0x06,0xd3,0x4d,0x62,0x00,' +` 0x86,0x53,0x45,0x02,0xef,0xcb,0x95,0x09,' +` 0x5f,0x5e,0xe2,0x08,0x58,0xe2,0x0a,0x00,' +` 0x08,0xce,0xe8,0xfe,0x95,0xd4,0x0c,0x00,' +` 0x00,0x17,0x2c,0x04,0x56,0x79,0x4c,0x02,' +` 0x11,0x11,0x11,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,0x01,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x17,' +` 0x00,0x00,0x00,0x0c,0xd3,0x4d,0x62,0x00,' +` 0x27,0x8c,0x9b,0x01,0x55,0x55,0x55,0x05,' +` 0x5f,0xc0,0xaf,0x00,0x6f,0xbc,0x1d,0x00,' +` 0x0c,0x4a,0xe1,0xff,0x0d,0xd5,0x5a,0x00,' +` 0x34,0x41,0xef,0x07,0x0e,0x08,0xcb,0x03,' +` 0x11,0x11,0x11,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,0x01,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0xe8,0x00,0x00,0x00,0x1e,' +` 0x00,0x00,0x00,0x01,0xd3,0x4d,0x62,0x00,' +` 0xb1,0xc2,0x09,0x04,0x00,0x00,0x00,0x40,' +` 0xa6,0x99,0x01,0x00,0xce,0xd8,0x0f,0x0a,' +` 0x1f,0x1a,0xf0,0xf5,0x83,0xc9,0xfe,0x01,' +` 0xdf,0x30,0x61,0x3a,0xcb,0x83,0x0e,0x01,' +` 0x55,0x55,0x55,0x01,0x77,0x77,0x77,0xff,' +` 0xd8,0x77,0x1f,0x00,0x05,0x00,0x00,0x00,' +` 0x00,0x00,0x0e,0x01,0x5c,0xf7,0x11,0x00,' +` 0x82,0x3a,0x97,0x00,0x5c,0xf7,0x25,0x00,' +` 0xc6,0xd6,0x02,0x00"' +) diff --git a/tools/topology/sof/pipe-multiband-drc-capture.m4 b/tools/topology/sof/pipe-multiband-drc-capture.m4 new file mode 100644 index 000000000..7900e8c77 --- /dev/null +++ b/tools/topology/sof/pipe-multiband-drc-capture.m4 @@ -0,0 +1,75 @@ +# Multiband DRC with volume Pipeline and PCM +# +# Pipeline Endpoints for connection are :- +# +# host PCM_P <-- B0 <-- MULTIBAND_DRC <-- B1 <-- sink DAI + +# Include topology builder +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`dai.m4') +include(`bytecontrol.m4') +include(`pipeline.m4') +include(`multiband_drc.m4') + +# +# Components and Buffers +# + +# Host "Multiband DRC Capture" PCM +# with 0 sink and 3 source periods +W_PCM_CAPTURE(PCM_ID, Multiband DRC Capture, 0, 3, SCHEDULE_CORE) + +define(MULTIBAND_DRC_priv, concat(`multiband_drc_bytes_', PIPELINE_ID)) +define(MY_MULTIBAND_DRC_CTRL, concat(`multiband_drc_control_', PIPELINE_ID)) +include(`multiband_drc_coef_default.m4') +C_CONTROLBYTES(MY_MULTIBAND_DRC_CTRL, PIPELINE_ID, + CONTROLBYTES_OPS(bytes, 258 binds the control to bytes get/put handlers, 258, 258), + CONTROLBYTES_EXTOPS(258 binds the control to bytes get/put handlers, 258, 258), + , , , + CONTROLBYTES_MAX(, 1024), + , + MULTIBAND_DRC_priv) + +# "MULTIBAND_DRC" has 2 sink periods and 2 source periods +W_MULTIBAND_DRC(0, PIPELINE_FORMAT, 2, 2, SCHEDULE_CORE, + LIST(` ', "MY_MULTIBAND_DRC_CTRL")) + +# Capture Buffers +W_BUFFER(0, COMP_BUFFER_SIZE(3, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_HOST_MEM_CAP) +W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_DAI_MEM_CAP) + +# +# Pipeline Graph +# +# host PCM_P <-- B0 <-- MULTIBAND_DRC <-- B1 <-- sink DAI + +P_GRAPH(pipe-pass-multiband-drc-capture-PIPELINE_ID, PIPELINE_ID, + LIST(` ', + `dapm(N_PCMC(PCM_ID), N_BUFFER(0))', + `dapm(N_BUFFER(0), N_MULTIBAND_DRC(0))', + `dapm(N_MULTIBAND_DRC(0), N_BUFFER(1))')) + +# +# Pipeline Source and Sinks +# +indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(1)) +indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Multiband DRC Capture PCM_ID) + +# +# PCM Configuration +# + +PCM_CAPABILITIES(Multiband DRC Capture PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), + PCM_MIN_RATE, PCM_MAX_RATE, 2, PIPELINE_CHANNELS, 2, 16, 192, + 16384, 65536, 65536) + +undefine(`MY_MULTIBAND_DRC_CTRL') +undefine(`MULTIBAND_DRC_priv') diff --git a/tools/topology/sof/pipe-multiband-drc-playback.m4 b/tools/topology/sof/pipe-multiband-drc-playback.m4 new file mode 100644 index 000000000..d97090ba2 --- /dev/null +++ b/tools/topology/sof/pipe-multiband-drc-playback.m4 @@ -0,0 +1,82 @@ +# Multiband DRC with volume Pipeline and PCM +# +# Pipeline Endpoints for connection are :- +# +# host PCM_P --> B0 --> MULTIBAND_DRC --> B1 --> sink DAI0 + +# Include topology builder +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`dai.m4') +include(`bytecontrol.m4') +include(`pipeline.m4') +include(`multiband_drc.m4') + +# +# Controls +# + +# +# Components and Buffers +# + +# Host "Multiband DRC Playback" PCM +# with 2 sink and 0 source periods +W_PCM_PLAYBACK(PCM_ID, Multiband DRC Playback, 2, 0, SCHEDULE_CORE) + +# +# Multiband DRC Configuration +# + +define(MULTIBAND_DRC_priv, concat(`multiband_drc_bytes_', PIPELINE_ID)) +define(MY_MULTIBAND_DRC_CTRL, concat(`multiband_drc_control_', PIPELINE_ID)) +include(`multiband_drc_coef_default.m4') +C_CONTROLBYTES(MY_MULTIBAND_DRC_CTRL, PIPELINE_ID, + CONTROLBYTES_OPS(bytes, 258 binds the control to bytes get/put handlers, 258, 258), + CONTROLBYTES_EXTOPS(258 binds the control to bytes get/put handlers, 258, 258), + , , , + CONTROLBYTES_MAX(, 1024), + , + MULTIBAND_DRC_priv) + +# "MULTIBAND_DRC" has 2 sink periods and 2 source periods +W_MULTIBAND_DRC(0, PIPELINE_FORMAT, 2, 2, SCHEDULE_CORE, + LIST(` ', "MY_MULTIBAND_DRC_CTRL")) + +# Playback Buffers +W_BUFFER(0, COMP_BUFFER_SIZE(2, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_HOST_MEM_CAP) +W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_DAI_MEM_CAP) + +# +# Pipeline Graph +# +# host PCM_P --> B0 --> MULTIBAND_DRC --> B1 --> sink DAI0 + +P_GRAPH(pipe-multiband-drc-playback-PIPELINE_ID, PIPELINE_ID, + LIST(` ', + `dapm(N_BUFFER(0), N_PCMP(PCM_ID))', + `dapm(N_MULTIBAND_DRC(0), N_BUFFER(0))', + `dapm(N_BUFFER(1), N_MULTIBAND_DRC(0))')) + +# +# Pipeline Source and Sinks +# +indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(1)) +indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Multiband DRC Playback PCM_ID) + +# +# PCM Configuration +# + +PCM_CAPABILITIES(Multiband DRC Playback PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), PCM_MIN_RATE, + PCM_MAX_RATE, 2, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536) + +undefine(`MY_MULTIBAND_DRC_CTRL') +undefine(`MULTIBAND_DRC_priv')