From 4f4b1e6916e6b42235de3a57920554ba5d2365e5 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Wed, 27 Nov 2024 11:40:16 +0200 Subject: [PATCH 1/2] Tools: Test: Audio: Fix IIR and FIR tests handling in process_test.m The component names are slightly different in IPC4 test topologies for sof-testbench4, so the script is updated to handle both names like eq-iir and eqiir. This avoids reporting failure in gain and frequency response mask tests. The help text and default are also updated for default sof-testbench4. Signed-off-by: Seppo Ingalsuo --- tools/test/audio/process_test.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/test/audio/process_test.m b/tools/test/audio/process_test.m index 4b90a2908b88..70df2978a439 100644 --- a/tools/test/audio/process_test.m +++ b/tools/test/audio/process_test.m @@ -13,8 +13,8 @@ % xtrun - set to 'xt-run' or 'xt-run --turbo' to test with xt-testbench % % E.g. -% process_test('eq-iir', 32, 32, 48000, 0, 0, 'xt-run --turbo'); -% process_test('eq-iir', 32, 32); +% process_test('eqiir', 32, 32, 48000, 0, 0, 'xt-run --turbo'); +% process_test('eqiir', 32, 32); % SPDX-License-Identifier: BSD-3-Clause % Copyright(c) 2017-2022 Intel Corporation. All rights reserved. @@ -23,7 +23,7 @@ function [n_fail, n_pass, n_na] = process_test(comp, bits_in_list, bits_out_list, fs, fulltest, show_plots, xtrun) %% Defaults for call parameters if nargin < 1 - comp = 'EQIIR'; + comp = 'eqiir'; end if nargin < 2 @@ -340,10 +340,10 @@ function test = g_spec(test, prm) switch lower(test.comp) - case 'eq-iir' + case {'eq-iir', 'eqiir'} blob = fullfile(prm.blobpath, prm.iirblob); h = sof_eq_blob_plot(blob, 'iir', test.fs, test.f, 0); - case 'eq-fir' + case {'eq-fir', 'eqfir'} blob = fullfile(prm.blobpath, prm.firblob); h = sof_eq_blob_plot(blob, 'fir', test.fs, test.f, 0); otherwise @@ -356,10 +356,10 @@ function test = fr_mask(test, prm) switch lower(test.comp) - case 'eq-iir' + case {'eq-iir', 'eqiir'} blob = fullfile(prm.blobpath, prm.iirblob); h = sof_eq_blob_plot(blob, 'iir', test.fs, test.f, 0); - case 'eq-fir' + case {'eq-fir', 'eqfir'} blob = fullfile(prm.blobpath, prm.firblob); h = sof_eq_blob_plot(blob, 'fir', test.fs, test.f, 0); otherwise From d5eb301425956a25bb62b3147633c42cc5612361 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Fri, 29 Nov 2024 15:26:02 +0200 Subject: [PATCH 2/2] Tools: Test: Audio: Update the README file This patch converts the README to Markdown .md format and updates the descriptions for key scripts for audio tests. Signed-off-by: Seppo Ingalsuo --- tools/test/audio/README | 64 ---------------------- tools/test/audio/README.md | 107 +++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 64 deletions(-) delete mode 100644 tools/test/audio/README create mode 100644 tools/test/audio/README.md diff --git a/tools/test/audio/README b/tools/test/audio/README deleted file mode 100644 index 488005a190a0..000000000000 --- a/tools/test/audio/README +++ /dev/null @@ -1,64 +0,0 @@ -SOF Audio Processing Components Tests -===================================== - -This is a set of test scripts to test that performance requirements -are met. The tests are currently for measured audio objective quality -parameters. The used criteria for performance is only an initial -assumption and need to be adjusted for various applications needs. - -The scripts support currently support the next list of objective -quality parameters. The test scripts need Matlab(R) [2] or GNU Octave -scientific programming language [3]. - - - Gain - - Frequency Response - - THD+N vs. Frequency - - Dynamic Range - - Attenuation of Alias Products - - Attenuation of Image Products - -Note: The metric is an effort to follow AES17 [1] recommendation for -parameters and test procedures. This was created to help developers to -quickly check their work but has not been verified to be -compliant. Professional equipment and formal calibration process is -recommended for professional applications where both accurate absolute -and relative metric is needed. - -Note: The test bench uses by default raw binary data files. It is -possible to convert with SoX (v14.4.1) [4] the raw data to e.g. wav -format for other audio tools and subjective listening. - -$ sox -b 32 -c 2 -r 48000 -L -e signed-integer fr_test_out.raw fr_test_out.wav - -For debugging purposes it is possible to switch from test scripts the -test vectors format to txt for easy manual data creation and -inspection. - - -Tests for component SRC ------------------------ - -The top level shell script to launch tests is src_test.sh. See script -src_run.sh for assumed install location of SOF host test bench -executable and component libraries. Exit code 0 indicates success and -exit code 1 indicates failed test cases. - -The default in/out rates matrix to test is defined in the beginning of -script src_test.m. The matrix can be also passed from calling function -src_test_top.m if need. - -The key objective quality parameters requiremements are in the -beginning of script src_test.m as well under comment Generic test -pass/fail criteria. - -Test run creates plots into directory "plots". Brief text format -reports are placed to directory "reports". - - -References ----------- - -[1] AES17-1015 standard, http://www.aes.org/publications/standards/search.cfm?docID=21 -[2] Matlab(R), https://www.mathworks.com/products/matlab.html -[3] GNU Octave, https://www.gnu.org/software/octave/ -[4] SoX - Sound eXchange, http://sox.sourceforge.net/ diff --git a/tools/test/audio/README.md b/tools/test/audio/README.md new file mode 100644 index 000000000000..e136e9aecf7e --- /dev/null +++ b/tools/test/audio/README.md @@ -0,0 +1,107 @@ +# SOF Audio Processing Components Tests + +### Test for processing components + +The script process_test.m provides tests to help to check that audio +performance requirements are met with run of SOF testbench with test +topologies. The tests are currently for measured audio objective +quality parameters. The used criteria for performance is only an +initial assumption and need to be adjusted for various applications +needs. + +The scripts support currently support the next list of objective +quality parameters. The test scripts need Matlab(R) [2] or GNU Octave +scientific programming language [3]. + + - Gain + - Frequency Response + - THD+N vs. Frequency + - Dynamic Range + - Attenuation of Alias Products + - Attenuation of Image Products + - Level Dependent Logarithmic Gain + +Note: The metric is an effort to follow AES17 [1] recommendation for +parameters and test procedures. This was created to help developers to +quickly check their work but has not been verified to be +compliant. Professional equipment and formal calibration process is +recommended for professional applications where both accurate absolute +and relative metric is needed. + +The process_test.m script is started from Octave or Matlab command shell. + +``` +octave --gui & +``` + +Examples of usage for it is shown with command help + +``` +help process_test +``` + +Tests for IIR equalizer with S32_LE input and output format with 48 +kHz rate, full test, plots shown, can be run with following command + +``` +process_test('eqiir', 32, 32, 48000, 1, 1); + +``` + +The components those can be tested with process_test are shown in the +next table. For sof-testbench4 use the 2nd column names,for +sof-testbench3 use the 3rd column names. + +| Component | IPC4 ID | IPC3 ID | +|---------------------------------|---------------|---------------| +| ARIA | aria | | +| ASRC | asrc | asrc | +| DC blocker | dcblock | dcblock | +| Dynamic range control | drc | drc | +| FIR equalizer | eqfir | eq-fir | +| Gain | gain | volume | +| IIR equalizer | eqiir | eq-iir | +| Multiband dynamic range control | drc_multiband | multiband-drc | +| SRC | src | src | +| Time domain fixed beamformer | tdfb | tdfb | + + +See README.md in tools/testbench provdes more information about using +the testbench. + +### Tests for component SRC and ASRC + +The Octave or Matlab script to test sample rate conversion is +src_test.m. See the help for src_test to see the usage. + +The top level shell script to launch tests is src_test.sh. See script +src_run.sh for assumed install location of SOF host test bench +executable and component libraries. Exit code 0 indicates success and +exit code 1 indicates failed test cases. + +The default in/out rates matrix to test is defined in the beginning of +script src_test.m. The matrix can be also passed from calling function +src_test_top.m if need. + +The key objective quality parameters requiremements are in the +beginning of script src_test.m as well under comment Generic test +pass/fail criteria. + +Test run creates plots into directory "plots". Brief text format +reports are placed to directory "reports". + +### Tests for component TDFB + +Scripts for testing special features of the multi-microphone beamformer +are in tdfb_test.m and tdfb_direction_test.m. See the help texts for usage. +Running the test needs special input files those have been created in blobs +export. See directory src/audio/tdfb/tune how to rebuild the blobs are +create simulation data files. + +References +---------- + +[1] AES17-2020 standard, http://www.aes.org/publications/standards/search.cfm?docID=21 +[2] Matlab(R), https://www.mathworks.com/products/matlab.html +[3] GNU Octave, https://www.gnu.org/software/octave/ +[4] SoX - Sound eXchange, http://sox.sourceforge.net/