Commit Graph

115 Commits

Author SHA1 Message Date
Seppo Ingalsuo 2950246415 Tools: Test: Audio: Add to process_test.m option to show plots
This change replaces 6th argument with show_plots. If it is
set to 1, the plots are not hidden. If set to 2, also the
temporary sound files are not deleted that is useful for
debugging.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-09-09 12:39:44 +03:00
Seppo Ingalsuo 85b8ab64ac Tools: Test: Audio: Fixes for process_test.m for moved files
The full process test fails due to changed paths of Octave
module setup scripts.

The path EQ blob decoder has changed after the EQ tool was moved
under the module. Also the SOF ABI version retrieve function
path need to be set to tune/common to use the generic function
instead of the first version that was made for EQ export.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-09-09 12:39:44 +03:00
Seppo Ingalsuo ad85184af0 Tools: Test: Audio: Mitigate trace flood in process_test.m
The verbose test trace flood slows down the test to near
unusable test times due to a lot of text printed to Octave
console. As result also the SOF CI logs become large.

This patch adds redirect of testbench trace into a temporary
file instead of standard output in process_test.m. The trace
content is printed in comp_run.sh to console only if there has
been an error. To prevent growing /tmp the trace file is
deleted after test run and possible print to console.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-27 13:39:53 +03:00
Seppo Ingalsuo 94e1bd2e6e Tools: test: Audio: Fix src_test.m run error
The SRC module tools have moved, so the path to retrieve SRC
filter spec has changed.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-21 14:29:17 +01:00
Seppo Ingalsuo 980b9884f7 Tools: Test: Audio: Remove unused argument from src_test.m
In function test_run_src() the second argument "t" is not used
so it can be safely removed.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-11-20 15:43:51 +00:00
Marc Herbert 008815dd54 tools/test/topology: mass replace codec_master -> codec_provider
This removes a lot of warning noise and may help spot other warnings
like `ALSA lib ops.c:48:(lookup_ops) wrong kcontrol ops value string ''`
and others.

Now that commit 1b1ec6c492 ("topology/cmake: skip all topologies when
alsatplg < 1.2.5") enforces alsatplg version >= 1.2.5, it is finally safe
to do this!

I compared the generated .tplg files before/after this commit and
they're bit for bit identical. Tested with  alsatplg v2.6.1 from
Ubuntu 22.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-11-09 11:20:09 +02:00
Seppo Ingalsuo 1b9681e00f Tools: Test: Audio: Add possibility to test ASRC with src_test.m
The same tests can be applied for ASRC in sychronous mode. This
patch allows to pass component name as last argument. Use it
this way:

src_test(32, 32, 44100, 48000, 0, 1, 'asrc');

or

src_test(32, 32, 44100, 48000, 0, 1, 'src');
src_test(32, 32, 44100, 48000, 0, 1);

To run ASRC or SRC. See "help src_test" output for all
test options.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-11-03 16:59:59 +00:00
Seppo Ingalsuo 8ca07591c9 Tools: Test: Topology: Avoid dependence to platform/intel/bxt.m4
A simplified copy of previous bxt.m4 is made as local
platform/generic.m4 with SSP and other platform definitions
for test topologies build. It is included to test-all,
test-capture, and test-playback macros definitions.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-10-27 12:31:35 +03:00
Seppo Ingalsuo 869666061b Tools: Test: Audio: Fix syntax error in test_run.m
The fprintf() command prints only "#!/bin/sh". For some reason
this has been ignored by interpreter but as clear error it is
better to fix.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-06-06 15:32:45 +03:00
Seppo Ingalsuo 0cb752d362 Tools: Test: Audio: Valgrind run related fixes
The changes to scripts/host-testbench.sh and earlier to process_test.m
have unintentionally dropped valgrind run from test.

This patch enables valgrind for process_test.m runs and fixes
issue in test run octave side function to silently ignore
error about failed shell command. Normally test fail when there
is no data or incorrect data, but a valgrind failure with correct
test output was passed.

Valgrind output becomes visible if testbench run trace stderr
redirection to file is disabled. If not done valgrind error would
stop the test but the analysis would not be printed to console.

Fixes: 6b744bcc63 ("host-testbench.sh: use process_test.m for 8 components")

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-06-06 15:32:45 +03:00
Seppo Ingalsuo e4342324c0 Tools: Test: Audio: Add test for level dependent gain
This patch adds to process_test.m test with amplitude sweep
to determine level dependent logarithmic gain.

Currently there is no test pass/fail criteria. But the test result
plot can be examined from directory plots. E.g. first full test
for DRC with "process_test('drc', 32, 32, 48000, 1);".

The view the plots from shell with "eog plots/ldlg_drc_*.png". Or
examine the plots directory with a file maneger GUI.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-05-25 14:42:24 +03:00
Seppo Ingalsuo 43b08c62b5 Tools: Test: Audio: Convert tabs to spaces in comp_run.sh
No script changes, just unify shell script style to be
with indents with spaces instead of both tabs and spaces.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-05-04 18:07:52 +03:00
Seppo Ingalsuo b4af9d93a1 Tools: Test: Changes for process_test.m run with xt-xcc
This patch adds to process_test() sixth argument to run the tests
with xt-run environment with argument set to 'xt-run' or
'xt-run --turbo'.

The set and print of LD_LIBRARY_PATH is no more needed with static
testbench version.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-05-04 18:07:52 +03:00
Seppo Ingalsuo d472a2e73d Tools: Test: Audio: Fix BITS_OUT in test run configuration
This patch fixes a mistake with test run configuration for
testbech tests where input and output word lengths are not
the same.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-02-01 16:39:20 +00:00
Seppo Ingalsuo f6b8b0e485 Tools: Test: In src_test.m do quick test without specify in/out rates
If the rates are an empty vector [] the default rates are used. This
allows test command "src_test(32, 32, [], [], 0, 0);" to do a quick
test without plots with default 8 - 192 kHz in/out matrix.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-12-02 15:30:14 +00:00
Seppo Ingalsuo 082672ea9f Tools: Test: In src_test.m prevent error with empty plot handle
Octave errors if plot handle is empty, Matlab doesn't. This can
happen if frequency response test data read fails. In that case
an empty plot window is stored as indication of error.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-12-02 15:30:14 +00:00
Seppo Ingalsuo 48bf7af183 Tools: Test: Prevent in src_test.m unnecessary window open
This speeds up src_test.m with no plot window opening for rate
that is not supported in the conversions matrix. No output file
returns failure -1.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-12-02 15:30:14 +00:00
Seppo Ingalsuo dccae1c5b2 Tools: Test: Audio: Reduce testing verbosity in test measure scripts
These prints are normally not useful and slow down test with a
lot of scrolled text output.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-12-02 15:30:14 +00:00
Seppo Ingalsuo 155137b878 Tools: Test: Timeout src_test.m after 300k copy() iterations
This prevents testbench run freeze from src_test.m. Function
test_run_src() passes to testbench option -C that limits the number
iterations to 300k that corresponds to 5 min of audio.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-12-02 15:30:14 +00:00
Seppo Ingalsuo f5dd529190 Tools: Test: Remove unused variable from src_test.m
The variable tn is not used, it is safe to delete it.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-11-18 10:10:16 +00:00
Seppo Ingalsuo 1d81cb6a62 Tools: Test: Audio: Fix typo in THD+N help text
There's incorrect dynamic range test function usage in help.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-11-18 10:10:16 +00:00
Seppo Ingalsuo 00c51bde78 Tools: Test: Audio: In markers find fail show the captured waveform
This patch adds to chirp test (executed first usually) plot of
audio waveform to help understand why the audio markers were not
found. The reasons like very low level or corruption or large
time shift can be seen from the plot easily.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-11-18 10:10:16 +00:00
Seppo Ingalsuo db66ae457b Tools: Test: Add to SRC test control for quick test and make plots
This patch helps to avoid editing the script to change the test
behavior. The full_test set to 0 performs a quick test with chirp
(default 1).  The option show_plots set to 1 (default 0) shows
the plot graps from each test step those help to understand the
test verdict.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-11-18 10:10:16 +00:00
Seppo Ingalsuo 5471357792 Tools: Test: Audio: Replace the gaussian dither with triangular
The gaussian (or other normal distribution shape) dither impacts
too much 16 bit signals. The triangular probability density
function (TDPF) is a sufficient compromise between added noise energy
and de-correlation of PCM samples.

This change improves for 48 kHz 16 bit audio measurement the THD+N
from -62.6 dB to -73.6 dB.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-11-18 10:10:16 +00:00
Seppo Ingalsuo 044d0b208d Tools: Test: Audio: In SRC THD+N test apply standard low pass
This patch applies for conversions where Nyquist rate allows
a 20 kHz low-pass filter as specified in AES17 standard (test.fu).
The sweep test is set no higher than 20 kHz (test.f_end).

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-11-18 10:10:16 +00:00
Seppo Ingalsuo 2841dc93c2 [SKIP CI] Tools: Test: Audio: Fix standard low-pass help text
Fix a confusing mistake high-pass -> low_pass and typo. It's
only a user help text change for "help stdlpf".

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-21 12:24:25 +01:00
Seppo Ingalsuo ab8c150b93 [SKIP CI] Tools: Test: Fix upper band limit in THD+N SRC test
This patch fixes the upper frequency for distortion plus noise
measurement. The min(fs1, fs2) leaves part of upper band unmeasured
and gives a too good looking THD+N performance figure when output
rate is higher than input rate. The proper way is to measure the
(near) full output rate bandwidth.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-19 16:20:43 +01:00
Seppo Ingalsuo f3fee13471 Tools: Test: Fix false success if no processing happened
The test is treated passed if there were no failed cases. The fix in
this patch is to force one failed case if both failed and passed counts
are zeros. Then the upper level test scripts/host-testbench.sh reports
correctly the test fail.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-19 14:37:00 +01:00
Seppo Ingalsuo e2d73e236a Tools: Topology1: Add MFCC component
This patch adds basic macros needed for MFCC in testbench and in
developmemnt topologies for hda-generic-2ch and up2. The
configuration blob in this matches the reference Matlab code
as configured to match Pytorch default MFCC.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-10-05 13:07:10 +01:00
Fred Oh 51abaff072 Tools: Testbench: add suffix to keep all the logs
When series of tests are run, only last result with same component is
saved. Make unique output filename. For now adding bits per sample
at the end of file, all the logs can be saved.

Ideally datetime string would be good. I keep it as FIXME.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2022-09-07 22:09:33 +01:00
Fred Oh d9d5842654 Tools: Testbench: add fulltest parameter in process_test
fulltest param to control quick chirp test only or full test
including all quality tests.

As minor clean up, unused parameter in thdnf_mask() and test_run_process()
is removed.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2022-09-07 22:09:33 +01:00
Fred Oh 7eb9863cdc Tools: Testbench: apply common indentation for functions
No functional change. Set common function indentation and add comment
sections for better readability.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2022-09-07 22:09:33 +01:00
Fred Oh 86e6e4e5b0 Tools: Testbench: fix typo in copyright year
Obvious typo in copyright year, it is 2022.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2022-09-07 22:09:33 +01:00
Marc Herbert d0bc72290a test/tplg-build.sh: remove spurious xargs -n1 option
The xargs option `-I/--replace` hardcodes max lines `-L 1`. In other
words, it always splits the input line by line and ignores whitespace
delimiters inside each line. Initial xargs commit
d0f4aba934 ("topology: speed up topology build") used `--replace`
after `-n/--max-args=1` which was silently ignored by xargs version
4.7.0. Now xargs 4.8.0 prints the following warning:

  xargs: warning: options --max-args and --replace/-I/-i are mutually
        exclusive, ignoring previous --max-args value

Remove the ignored `-n 1` to remove the warning.

I compared the outputs before and after this commit and they're exactly
the same.

There's an extra twist. The same xargs command also uses the
`-d/--delimiter=,` option which makes xargs ignore newlines and
"translates" any max-line `-L` option to `--max-args`; including the `-L
1` max implied by `--replace`. This twist does not make a difference:
any max-line or max-args is always overridden by `--replace` whether
`--delimiter` is used or not.

Of course this entire xargs script is re-inventing (C)Make/ninja that
provide build parallelism for free and much more... I digress.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-09-02 11:25:19 +01:00
Seppo Ingalsuo 0d5e731b19 Audio: SRC: Add IPC4 full conversions matrix to SRC comp and tools
This patch adds the Kconfig option COMP_SRC_IPC4_FULL_MATRIX and
adds handling to src.c. Testbench build was changed to use this
largest matrix.

The coefficients were generated with script src_ipc4_int32.m. The
new sample rates were added to test script src_test.m.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-29 12:42:38 +01:00
Seppo Ingalsuo 0feff0b3e4 Tools: Test: Topology: Set DAI buffer periods to 3 for SRC tests
Test pipelines with SRC due internal block processing constraints need
this to avoid fail due to insufficient buffer. Other pipelines continue
to use 2 buffer periods.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-28 15:43:38 +01:00
Marc Herbert bde4858625 topologies: docker --env USE_XARGS, NO_PROCESSORS and VERBOSE
Building in parallel is much faster but it makes logs unreadable and
build failures impossible to understand. This is especially true when
building with recent ALSA that produces of deprecation warnings, see
examples below. For test topologies the problem is even worse: its
XARGS parallel build provides no log at all.

To find what actually fails, it is required to fall back on a single
threaded and verbose build and this is achieved with the variables
USE_XARGS, NO_PROCESSORS and VERBOSE. Pass these through docker-run.sh
and CMake.

Examples from #5608
https://github.com/thesofproject/sof/runs/5717553555?check_suite_focus=true
https://sof-ci.01.org/sofpr/PR5608/build12556/build/tools.txt

ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...
ALSA pcm.c:1471:(parse_hw_config) deprecated bclk value 'codec_slave',...
ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...
ALSA pcm.c:1471:(parse_hw_config) deprecated bclk value 'codec_slave',...
ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-05 14:37:28 +01:00
Marc Herbert 0bbdbb111f test/topology: make tplg-build.sh callable from anywhere
This removes two layers of indirection when trying to find what fails.
The lack of this proved especially painful when working on #5632 and
similar backports.

Also move outputs to a subdirectory by default. No change when invoked
from CMake which does not use the default output directory.

Also show the exact m4 and alsatplg commands run when not using XARGS
parallelization. Again this is critical when something fails.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-02 17:51:04 +01:00
Seppo Ingalsuo c9d603bb11 Tools: Test: Fix mistake in script test_run.m
Remove the extra argument for fprintf(). For some reason there was
no harm seen but this should trigger an error when run in Octave or
Matlab.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-03-09 15:44:06 +00:00
Seppo Ingalsuo 74fcc02ff5 Tools: Test, Tune: Improve Matlab scripts for EQ testing
The test scripts missed test component keyword change from e.g.
eqiir to eq-iir. Due to this the process_test() failed for IIR and
FIR for gain and frequency response due to wrong result expect.

The expected result is retrieved with the blob decode function. It
can be also used manually to check the filters defined in the
blob. The help texts in the decode functions needed fix. Also some
usage examples were added.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-18 21:47:16 +00:00
Marc Herbert 15a7774626 Revert "topologies: switch all .m4 files to codec_provider and codec_consumer"
This reverts commit f50b6fe0ad.

I discovered the hard way that this change causes alsatplg version
1.2.2 (the default version in the current LTS Ubuntu) to corrupt just
a few bytes in .tplg output in an incredibly discrete and
time-consuming way: no error message at build time and same file size.
See example at https://github.com/thesofproject/sof/pull/5162.

We could/should just require a minimum alsatplg version at the CMake
level but at this moment we don't even know which minimum version is
needed and we would also need to take some time to test a few alsatplg
versions. If version 1.2.2 would just fail with an decent error
message that can be searched and discussed then everything would be
fine but silent corruption is really not OK.

So users of recent versions will unfortunately have to live with the
huge number of warnings for now.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-18 11:22:36 +00:00
Seppo Ingalsuo e6f677959b Tools: Test: Audio: Fix typos in tools/test/audio/*
This patch fixes the typos in audio test Matlab code.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-09 09:52:17 +00:00
Seppo Ingalsuo 84c9033fea Tools: Test: Audio: Add sound direction test for TDFB
This patch adds Matlab script tdfb_direction_test.m. The test
simulates acoustical microphone array capture with 360 degrees
rotated noise source. The test topologies build adds an array
identifier to component name in topology file name. That
allows the scripts to simulate with several arrays. Now a
basic 2 mic array (no array suffix, just tdfb), 4 mic line,
and 8 mic circular are tested. Test pass/fail is so far only
visual check from plot.

The existing tdfb_test.c is extended to perform test with the
three test array configurations.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-08 12:34:32 +00:00
Seppo Ingalsuo 3faaf4c145 Tools: Audio: Test: In Matlab tests by default put trace to /dev/null
The trace print slows down the test a lot while the testbench
trace output is not needed usually in these audio quality
tests. The test script can set .trace to redirect trace to a file
that is also a lot faster than scrolling the trace in Matlab
or Octave shell.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:09:57 +00:00
Seppo Ingalsuo 0b4a796f72 Tools: Test: Audio: Delete only regular files in test begin
This patch adds test for to-be-deleted trace output file or
simulation output PCM data file. Doing delete only for regular
files allows to use e.g. /dev/null to redirect trace to
be not shown when not needed. Or run test in debugger without
need for output file.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:09:57 +00:00
Seppo Ingalsuo 15bf883ead Tools: Test: Audio: Fix incorrect valgrind run control in audio test
The value for VALGRIND in the run command parameters needs to
be true or false. The value "no" causes an error in comp_run.sh
script run.

Fixes 30012d1454

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-26 14:09:57 +00:00
Seppo Ingalsuo e0ec195bcd Test: Audio: Fix stdnotch_get() function issue in Matlab
The path append of current directory (.) is not correct for
the signal processing package function iirnotch. The issue does
not happen with Octave since it has pei_tseng_notch().

The standard notch function is used in all THD+N tests so this
issue has caused fail of nearly all tests with Matlab.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-24 11:23:21 +00:00
Seppo Ingalsuo 30012d1454 Tools: Testbench: Support for different in/out channels count and other
This patch adds to command line switch -n for output channels count.
Existing -c is for in channels, new -n is for out channels count. Out
channels count is same as input if -n is not present. Switch -q is
added to quiet the trace output if it is not needed.

The Matlab language test scripts for components are updated to use
the -t config.sh interface of comp_run.sh. It allows more flexible
control of input and output streams.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-01-24 11:23:21 +00:00
Marc Herbert f50b6fe0ad topologies: switch all .m4 files to codec_provider and codec_consumer
All .tplg output files have been compared and are strictly identical
after the change.

The deprecation warnings were added more than one year ago in
https://github.com/alsa-project/alsa-lib/commits//706192341d1d0bbb906

Now that we just upgraded our Docker image to ALSA 1.2.6
(https://hub.docker.com/r/thesofproject/sof/tags) so #5153 can enable
topology v2, the volume of warnings has became unbearable.  For instance
good luck trying to find the actual error messages for the build
failures of #5155 - they're totally drowned in these deprecation
warnings.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-10 11:52:26 +00:00
Ranjani Sridharan fcfd5d65be test: topology: fix build with latest alsa-lib
Remove the extra space to make the topology build with upstream
alsa-lib.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-01-06 09:52:51 -08:00