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

Access violation in saf_example_ambi_bin while loading HRTFs from SONICOM dataset #55

Open
1enn0 opened this issue May 30, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@1enn0
Copy link
Contributor

1enn0 commented May 30, 2023

Description

Using a HRTF from the SONICOM HRTF dataset will throw an exception (access violation). This has been tested with multiple HRTFs from the mentioned dataset.

Environment

  1. OS: Windows 11 22H2 (22621.1778)
  2. Compiler: MSVC 14.36.32532
  3. SAF performance library being used: SAF_USE_INTEL_MKL
  4. Any optional SAF flags enabled: SAF_ENABLE_SOFA_READER_MODULE, SAF_ENABLE_EXAMPLES_TESTS
  5. Visual Studio Professional 2022 17.6.2, CMake 3.26.2

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Modify test__saf_example_ambi_bin() in file src/test/test__examples.c to load a SOFA file from the SONICOM dataset:
    // ...
    ambi_bin_create(&hAmbi);
    ambi_bin_setSofaFilePath(hAmbi, "path/to/eg/P0010_Windowed_48kHz.sofa");
    // ...
  2. Build and run saf_test with above environment.

Expected Output

Test should pass.

Actual Output

Access violation in framework/modules/saf_utilities/saf_utility_geometry.c:782 while trying to read faceIdx[k]. faceIdx does not exist because nFaceIdx is 0 here.

Additional information

Call Stack:

[0] saf_test.exe!sphVoronoi
	at ...\framework\modules\saf_utilities\saf_utility_geometry.c(782)
[1] saf_test.exe!getVoronoiWeights
	at ...\framework\modules\saf_utilities\saf_utility_geometry.c(959)
[2] saf_test.exe!ambi_bin_initCodec
	at ...\examples\src\ambi_bin\ambi_bin.c(262)
[3] saf_test.exe!test__saf_example_ambi_bin
	at ...\test\src\test__examples.c(56)
[4] saf_test.exe!main_test
	at ...\test\src\saf_test.c(173)
[5] saf_test.exe!main
	at ...\test\src\saf_test_wrapper.cpp(30)
@1enn0 1enn0 added the bug Something isn't working label May 30, 2023
@rapolasd
Copy link
Contributor

Hi!

This is due to the fact that in the current release of the SONICOM HRTF database we kept redundant measurements of the top HRTF (90 degree elevation) in the sofa file (during the measurement, the top direction was measured each time the chair was rotated). Having multiple measurements at the same position in the sofa file caused the HRTF interpolation to fail. Since finding this bug ourselves, we decided to remove the redundant positions from the database. We will upload the new versions to the website soon but in the meantime, let me know if you want me to send you some specific corrected HRTF files directly.

This could also be an improvement to the SAF HRTF loader to check for overlapping positions, warn the user, and only take one of the measurements at that location.

@1enn0
Copy link
Contributor Author

1enn0 commented Aug 22, 2023

Hi @rapolasd,
thank you for the info! I suspected something like this might be happening. I'm happy to wait until you update the database :)

Meanwhile, I did a quick check some time ago and built the test above from the develop branch. IIRC, the issue did not appear (will have to verify). There was some work on the ambi_bin example app, for example this commit. Maybe @leomccormack can help whether the issue with the overlapping positions has already been addressed in some way?

@leomccormack leomccormack added the help wanted Extra attention is needed label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants