SAF
Loading...
Searching...
No Matches
saf_test.h
Go to the documentation of this file.
1/*
2 * Copyright 2020-2021 Leo McCormack
3 *
4 * This software is dual-licensed. Please refer to the LICENCE.md file for more
5 * information.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13 * PERFORMANCE OF THIS SOFTWARE.
14 */
15
52#ifndef __SAF_TEST_H_INCLUDED__
53#define __SAF_TEST_H_INCLUDED__
54
55#include "unity.h" /* unit testing suite (MIT license) */
56#include "timer.h" /* for timing the individual tests */
57#include "saf.h" /* master framework include header */
58#include "saf_externals.h" /* to also include saf dependencies (cblas etc.) */
59#ifdef SAF_ENABLE_EXAMPLES_TESTS
60# include "ambi_bin.h"
61# include "ambi_dec.h"
62# include "ambi_drc.h"
63# include "ambi_enc.h"
64# include "ambi_roomsim.h"
65# include "array2sh.h"
66# include "beamformer.h"
67# include "binauraliser.h"
68# include "binauraliser_nf.h"
69# include "decorrelator.h"
70# include "dirass.h"
71# include "matrixconv.h"
72# include "multiconv.h"
73# include "panner.h"
74# include "pitch_shifter.h"
75# include "powermap.h"
76# include "rotator.h"
77# include "sldoa.h"
78# include "spreader.h"
79# include "tvconv.h"
80#endif /* SAF_ENABLE_EXAMPLES_TESTS */
81
82#ifdef __cplusplus
83extern "C" {
84#endif /* __cplusplus */
85
87int main_test(void);
88
89/* ========================================================================== */
90/* SAF utilities module unit tests */
91/* ========================================================================== */
92
101void test__cart2sph(void);
104void test__delaunaynd(void);
108void test__quaternion(void);
116void test__saf_stft_LTI(void);
119void test__saf_rfft(void);
122void test__saf_fft(void);
125void test__saf_matrixConv(void);
129void test__qmf(void);
133void test__smb_pitchShifter(void);
136void test__sortf(void);
140void test__sortz(void);
144void test__cmplxPairUp(void);
149void test__getVoronoiWeights(void);
152void test__unique_i(void);
160void test__butterCoeffs(void);
168void test__faf_IIRFilterbank(void);
172void test__gexpm(void);
184void test__dvf_dvfShelfCoeffs(void);
185
186
187/* ========================================================================== */
188/* SAF cdf4sap module unit tests */
189/* ========================================================================== */
190
194void test__formulate_M_and_Cr(void);
199
200
201/* ========================================================================== */
202/* SAF hoa module unit tests */
203/* ========================================================================== */
204
211void test__truncationEQ(void);
212
213
214/* ========================================================================== */
215/* SAF sh module unit tests */
216/* ========================================================================== */
217
220void test__getSHreal(void);
224void test__getSHreal_recur(void);
228void test__getSHreal_part(void);
231void test__getSHcomplex(void);
234void test__getSHrotMtxReal(void);
238void test__real2complexSHMtx(void);
242void test__complex2realSHMtx(void);
255void test__sphMUSIC(void);
258void test__sphPWD(void);
261void test__sphESPRIT(void);
264void test__sphModalCoeffs(void);
267void test__arraySHTmatrices(void);
268
269
270/* ========================================================================== */
271/* SAF hrir module unit tests */
272/* ========================================================================== */
273
276void test__resampleHRIRs(void);
277
278
279/* ========================================================================== */
280/* SAF reverb module unit tests */
281/* ========================================================================== */
282
286void test__ims_shoebox_TD(void);
290void test__ims_shoebox_RIR(void);
291
292
293/* ========================================================================== */
294/* SAF vbap module unit tests */
295/* ========================================================================== */
296
297
298/* ========================================================================== */
299/* SAF sofa reader module unit tests */
300/* ========================================================================== */
301
302#ifdef SAF_ENABLE_SOFA_READER_MODULE
303
306void test__saf_sofa_open(void);
309void test__mysofa_load(void);
312void test__sofa_comparison(void);
313
314#endif /* SAF_ENABLE_SOFA_READER_MODULE */
315
316
317/* ========================================================================== */
318/* SAF tracker module unit tests */
319/* ========================================================================== */
320
321#ifdef SAF_ENABLE_TRACKER_MODULE
322
326void test__tracker3d(void);
327
328#endif /* SAF_ENABLE_TRACKER_MODULE */
329
330
331/* ========================================================================== */
332/* SAF HADES module unit tests */
333/* ========================================================================== */
334
335#ifdef SAF_ENABLE_HADES_MODULE
336
338void test__hades(void);
339
340#endif /* SAF_ENABLE_HADES_MODULE */
341
342
343/* ========================================================================== */
344/* SAF resources unit tests */
345/* ========================================================================== */
346
350void test__afSTFT(void);
354void test__realloc2d_r(void);
357void test__malloc4d(void);
360void test__malloc5d(void);
363void test__malloc6d(void);
364
365
366/* ========================================================================== */
367/* SAF examples unit tests */
368/* ========================================================================== */
369
370#ifdef SAF_ENABLE_EXAMPLES_TESTS
371
396
397#endif /* SAF_ENABLE_EXAMPLES_TESTS */
398
399
400/* ========================================================================== */
401/* SAF DVF module unit tests */
402/* ========================================================================== */
403
404
405
406#ifdef __cplusplus
407} /* extern "C" */
408#endif /* __cplusplus */
409
410#endif /* __SAF_TEST_H_INCLUDED__ */
A binaural Ambisonic decoder for reproducing Ambisonic sound scenes over headphones.
A frequency-dependent Ambisonic decoder for reproducing Ambisonic sound scenes over loudspeakers.
A frequency-dependent Ambisonic sound scene dynamic range compressor (DRC)
A basic Ambisonic encoder.
A simple shoebox room Ambisonic encoder.
Spatially encodes spherical microphone array signals into spherical harmonic signals (aka: Ambisonic ...
Generates beamformers/virtual microphones in arbitrary directions with several different beam pattern...
Convolves input audio (up to 64 channels) with interpolated HRTFs in the time-frequency domain.
Convolves input audio (up to 64 channels) with interpolated HRTFs in the time-frequency domain,...
A multi-channel decorrelator.
A sound-field visualiser based on the directional re-assignment of beamformer energy based on local D...
A standard matrix convolver.
A multi-channel convolver.
A frequency-dependent 3D panner based on the Vector-base Amplitude Panning (VBAP) method [1],...
A very basic multichannel pitch shifter.
A sound-field visualiser, which utilises spherical harmonic signals as input; note this code is a rem...
A basic spherical harmonic/ Ambisonic signals rotator, based on the recursive approach detailed in [1...
Main include header for the Spatial_Audio_Framework (SAF)
Include header for SAF externals.
void test__real2complexSHMtx(void)
Testing the real to complex spherical harmonic conversion, using getSHcomplex() as the reference.
void test__formulate_M_and_Cr(void)
Testing the formulate_M_and_Cr() function, and verifying that the output mixing matrices yield signal...
void test__calculateGridWeights(void)
Test grid weight approximation.
void test__sphPWD(void)
Testing the DoA estimation performance of sphPWD()
void test__saf_fft(void)
Testing the forward and backward complex-complex FFT (saf_fft)
void test__realloc2d_r(void)
Testing the realloc2d_r() function (reallocating 2-D array, while retaining the previous data order; ...
void test__evalIIRTransferFunction(void)
Testing that the magnitudes and phases returned by evalIIRTransferFunction() are numerically similar ...
void test__getSHreal_recur(void)
Testing that the getSHreal_recur() function is somewhat numerically identical to the full-fat getSHre...
void test__getVoronoiWeights(void)
Testing that the weights from the getVoronoiWeights() function sum to 4pi and that the weights are al...
void test__sphericalBesselFunctions(void)
Testing bessel_jn(), bessel_in(), bessel_yn(), and bessel_kn()
void test__truncationEQ(void)
Testing the truncation EQ.
void test__ims_shoebox_RIR(void)
Testing the ims shoebox simulator, when generating room impulse respones (RIRs) from the computed ech...
void test__getSHreal(void)
Testing the orthogonality of the getSHreal() function.
void test__saf_stft_50pc_overlap(void)
Testing for perfect reconstruction of the saf_stft (when configured for 50% window overlap)
void test__butterCoeffs(void)
Testing that the coefficients computed with butterCoeffs() are numerically similar to the "butter" fu...
void test__sortf(void)
Testing the sortf() function (sorting real floating point numbers)
void test__cmplxPairUp(void)
Testing the cmplxPairUp() function (grouping up conjugate symmetric values)
void test__smb_pitchShifter(void)
Testing that the smb_pitchShifter can shift the energy of input spectra by one octave down.
void test__arraySHTmatrices(void)
Testing the arraySHTmatrices() function.
void test__unique_i(void)
Testing that the unique_i() function operates correctly.
void test__getLoudspeakerDecoderMtx(void)
Testing to assure that (given a uniform loudspeaker layout), the SAD, MMD and EPAD decoders are all e...
void test__saf_example_array2sh(void)
Testing the SAF array2sh.h example (this may also serve as a tutorial on how to use it)
void test__saf_example_rotator(void)
Testing the SAF rotator.h example (this may also serve as a tutorial on how to use it)
void test__saf_rfft(void)
Testing the forward and backward real-(half)complex FFT (saf_rfft)
void test__getSHreal_part(void)
Testing that the getSHreal_part() function is somewhat numerically identical to the full-fat getSHrea...
void test__cylindricalBesselFunctions(void)
Testing bessel_Jn(), bessel_Yn()
void test__sphESPRIT(void)
Testing the DoA estimation performance of sphESPRIT()
void test__dvf_dvfShelfCoeffs(void)
Test the generation of high shelf coeffs based on shelf gain and fc parameters.
void test__delaunaynd(void)
Testing that the delaunaynd() function can triangulate basic shapes.
void test__malloc6d(void)
Testing that malloc6d() works, and is truely contiguously allocated.
void test__getSHrotMtxReal(void)
Testing the spherical harmonic rotation matrix function getSHrotMtxReal()
void test__sphModalCoeffs(void)
Testing the sphModalCoeffs() function.
void test__afSTFT(void)
Testing the alias-free STFT filterbank (near)-perfect reconstruction performance.
void test__saf_example_ambi_enc(void)
Testing the SAF ambi_enc.h example (this may also serve as a tutorial on how to use it)
void test__saf_example_ambi_bin(void)
Testing the SAF ambi_bin.h example (this may also serve as a tutorial on how to use it)
void test__formulate_M_and_Cr_cmplx(void)
Testing the formulate_M_and_Cr_cmplx() function, and verifying that the output mixing matrices yield ...
void test__complex2realSHMtx(void)
Testing the complex to real spherical harmonic conversion, using getSHreal() as the reference.
void test__computeSectorCoeffsEP(void)
Testing the computeSectorCoeffsEP() and computeVelCoeffsMtx() functions and comparing their output to...
void test__faf_IIRFilterbank(void)
Testing that the faf_IIRFilterbank can reconstruct the original signal power.
void test__checkCondNumberSHTReal(void)
Testing that for T-designs, the condition numbers are all equal to 1.
void test__qmf(void)
Testing the (near)-perfect reconstruction performance of the QMF filterbank.
void test__hades(void)
Test for hades.
void test__gexpm(void)
Testing computing the matrix exponential - comparing the output to that of the "expm" function in Mat...
void test__dvf_interpDVFShelfParams(void)
Test the interpolation of high shelf parameters based on distance and incidence angle parameters.
void test__sortz(void)
Testing the sortz() function (sorting complex double-floating point numbers)
void test__cart2sph(void)
Testing cart2sph() and sph2cart() are reversible.
void test__mysofa_load(void)
Testing the dependency free mysofa SOFA reader.
void test__dvf_calcDVFShelfParams(void)
Calculate high shelf parameters, g0, gInf, fc, from the lookup table coefficients (10 degree steps)
void test__tracker3d(void)
Testing that the particle-filtering based tracker is able to correctly track two simultaneous targets...
int main_test(void)
Main unit testing program.
Definition saf_test.c:73
void test__saf_example_spreader(void)
Testing the SAF spreader.h example (this may also serve as a tutorial on how to use it)
void test__malloc5d(void)
Testing that malloc5d() works, and is truely contiguously allocated.
void test__getSHcomplex(void)
Testing the orthogonality of the getSHcomplex() function.
void test__malloc4d(void)
Testing that malloc4d() works, and is truely contiguously allocated.
void test__saf_matrixConv(void)
Testing the saf_matrixConv.
void test__sphMUSIC(void)
Testing the DoA estimation performance of sphMUSIC()
void test__saf_sofa_open(void)
Testing the SAF SOFA reader that uses the netcdf library.
void test__ims_shoebox_TD(void)
Testing the ims shoebox simulator, when applying the echograms in the time- domain.
void test__latticeDecorrelator(void)
Testing the performance of the latticeDecorrelator, verifying that the inter- channel cross-correlati...
void test__saf_example_ambi_dec(void)
Testing the SAF ambi_dec.h example (this may also serve as a tutorial on how to use it)
void test__saf_stft_LTI(void)
Testing for perfect reconstruction of the saf_stft (when configured for linear time-invariant (LTI) f...
void test__sofa_comparison(void)
Testing that the two SOFA readers produce the same results.
void test__resampleHRIRs(void)
Testing that resampleHRIRs() is resampling adequately.
void test__quaternion(void)
Testing that quaternion2rotationMatrix() and rotationMatrix2quaternion() are reversible.
A spatially-localised active-intensity (SLAI) based direction-of- arrival estimator (SLDoA)
An arbitrary array panner (HRIRs, microphone array IRs, etc.) with coherent and incoherent spreading ...
A time-varying multi-channel convolver.