From 1a27843e4baf0ea326d727d55c1b248095e2c87f Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 10 Jun 2024 15:31:50 +0300 Subject: [PATCH] Audio: Multiband-DRC: Fix paths after move of scripts The paths to topology and sof-ctl blobs are updated. The paths to other setup scripts (common, crossover, drc, eq) are set with a new helper function multiband_drc_paths.m. Signed-off-by: Seppo Ingalsuo --- .../multiband_drc/tune/drc_gen_quant_coefs.m | 4 --- .../tune/example_multiband_drc.m | 20 ++++++----- .../multiband_drc/tune/iir_gen_quant_coefs.m | 4 --- .../multiband_drc/tune/multiband_drc_paths.m | 33 +++++++++++++++++++ 4 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 src/audio/multiband_drc/tune/multiband_drc_paths.m diff --git a/src/audio/multiband_drc/tune/drc_gen_quant_coefs.m b/src/audio/multiband_drc/tune/drc_gen_quant_coefs.m index 446287399213..fa39750214ad 100644 --- a/src/audio/multiband_drc/tune/drc_gen_quant_coefs.m +++ b/src/audio/multiband_drc/tune/drc_gen_quant_coefs.m @@ -1,12 +1,8 @@ function drc_coefs = drc_gen_quant_coefs(num_bands, sample_rate, params); -addpath ../drc - for i = 1:num_bands coefs = drc_gen_coefs(params(i), sample_rate); drc_coefs(i) = drc_generate_config(coefs); end -rmpath ../drc - end diff --git a/src/audio/multiband_drc/tune/example_multiband_drc.m b/src/audio/multiband_drc/tune/example_multiband_drc.m index e5ab9880888a..a5b7450b5bc7 100644 --- a/src/audio/multiband_drc/tune/example_multiband_drc.m +++ b/src/audio/multiband_drc/tune/example_multiband_drc.m @@ -19,14 +19,17 @@ function example_multiband_drc() function export_multiband_drc(prm) +multiband_drc_paths(true); + % Set the parameters here -tplg1_fn = sprintf("../../topology/topology1/m4/multiband_drc_coef_%s.m4", prm.name); % Control Bytes File -tplg2_fn = sprintf("../../topology/topology2/include/components/multiband_drc/%s.conf", prm.name); % Control Bytes File +sof_tools = '../../../../tools'; +tplg1_fn = sprintf("%s/topology/topology1/m4/multiband_drc_coef_%s.m4", sof_tools, prm.name); % Control Bytes File +tplg2_fn = sprintf("%s/topology/topology2/include/components/multiband_drc/%s.conf", sof_tools, prm.name); % Control Bytes File % Use those files with sof-ctl to update the component's configuration -blob3_fn = sprintf("../../ctl/ipc3/multiband_drc/%s.blob", prm.name); % Blob binary file -alsa3_fn = sprintf("../../ctl/ipc3/multiband_drc/%s.txt", prm.name); % ALSA CSV format file -blob4_fn = sprintf("../../ctl/ipc4/multiband_drc/%s.blob", prm.name); % Blob binary file -alsa4_fn = sprintf("../../ctl/ipc4/multiband_drc/%s.txt", prm.name); % ALSA CSV format file +blob3_fn = sprintf("%s/ctl/ipc3/multiband_drc/%s.blob", sof_tools, prm.name); % Blob binary file +alsa3_fn = sprintf("%s/ctl/ipc3/multiband_drc/%s.txt", sof_tools, prm.name); % ALSA CSV format file +blob4_fn = sprintf("%s/ctl/ipc4/multiband_drc/%s.blob", sof_tools, prm.name); % Blob binary file +alsa4_fn = sprintf("%s/ctl/ipc4/multiband_drc/%s.txt", sof_tools, prm.name); % ALSA CSV format file endian = "little"; @@ -116,6 +119,8 @@ function export_multiband_drc(prm) drc_params(4).band_lower_freq = prm.band_lower_freq(4) / nyquist; % Generate Emphasis/Deemphasis IIR filter quantized coefs struct from parameters + + [emp_coefs, deemp_coefs] = iir_gen_quant_coefs(iir_params); % Generate Crossover quantized coefs struct from parameters @@ -128,7 +133,6 @@ function export_multiband_drc(prm) drc_coefs = drc_gen_quant_coefs(num_bands, sample_rate, drc_params); % Generate output files -addpath ../common % Convert quantized coefs structs to binary blob blob8 = multiband_drc_build_blob(num_bands, enable_emp_deemp, emp_coefs, ... @@ -145,6 +149,6 @@ function export_multiband_drc(prm) sof_ucm_blob_write(blob4_fn, blob8_ipc4); alsactl_write(alsa4_fn, blob8_ipc4); -rmpath ../common +multiband_drc_paths(false); end diff --git a/src/audio/multiband_drc/tune/iir_gen_quant_coefs.m b/src/audio/multiband_drc/tune/iir_gen_quant_coefs.m index b91c4e0998f3..dafeb3cfe30b 100644 --- a/src/audio/multiband_drc/tune/iir_gen_quant_coefs.m +++ b/src/audio/multiband_drc/tune/iir_gen_quant_coefs.m @@ -76,8 +76,6 @@ bits_gain = 16; % Q2.14 qf_gain = 14; -addpath ../eq - quant_coefs = cell(1, 2); for i = 1:length(coefs) coef = cell2mat(coefs(i)); @@ -88,8 +86,6 @@ quant_coefs = cell2mat(quant_coefs); -rmpath ../eq - end function [bq1, bq2] = stage_gain_adjust(prev_bq1, prev_bq2) diff --git a/src/audio/multiband_drc/tune/multiband_drc_paths.m b/src/audio/multiband_drc/tune/multiband_drc_paths.m new file mode 100644 index 000000000000..2a5e4ae7595b --- /dev/null +++ b/src/audio/multiband_drc/tune/multiband_drc_paths.m @@ -0,0 +1,33 @@ +function multiband_drc_paths(enable) + +% multiband_drc_paths(enable) +% enable - set to true to enable needed search path +% set to false to disable the search paths +% + +% SPDX-License-Identifier: BSD-3-Clause +% +% Copyright (c) 2024, Intel Corporation. All rights reserved. + + common = '../../../../tools/tune/common'; + crossover = '../../../../tools/tune/crossover'; + drc = '../../../../tools/tune/drc'; + eq = '../../../../tools/tune/eq'; + # After #9215 merge use this: + # crossover = '../../crossover/tune'; + # After #9188 merge use this: + # drc = '../../drc/tune'; + # After #9187 merge use this: + # eq = '../../eq_iir/tune'; + if enable + addpath(common); + addpath(crossover); + addpath(drc); + addpath(eq); + else + rmpath(common); + rmpath(crossover); + rmpath(drc); + rmpath(eq); + end +end