Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools: Test: Audio: Fix IIR and FIR tests handling in process_test.m #9685

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions tools/test/audio/README

This file was deleted.

107 changes: 107 additions & 0 deletions tools/test/audio/README.md
Original file line number Diff line number Diff line change
@@ -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/
14 changes: 7 additions & 7 deletions tools/test/audio/process_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading