xiph / rnnoise

Recurrent neural network for audio noise reduction
BSD 3-Clause "New" or "Revised" License
3.97k stars 890 forks source link

Add USE_MALLOC define, to toggle the use of malloc() and free() instead of VLA #164

Open davidebeatrici opened 3 years ago

davidebeatrici commented 3 years ago

This is required for MSVC.

petterreinholdtsen commented 3 years ago

The USE_MALLOC name is a bit confusing, as the code of course use mallom even if USE_MALLOC is not defined... What about HAVE_VLA_SUPPORT or something like that instead? Is there some flag in modern C that can be used to detect compilers with such advanced feature available without manually setting a flag?

davidebeatrici commented 3 years ago

According to https://stackoverflow.com/a/49988810 we can use __STDC_NO_VLA__.

davidebeatrici commented 3 years ago

Should I do that?

petterreinholdtsen commented 3 years ago

[Davide Beatrici]

Should I do that?

I have no idea who would make such decision, but for what it is worth, I believe it is a better idea to automatically detect the need than to depend on a manually set flag. So if it was up to me, I would do it. :) -- Happy hacking Petter Reinholdtsen

marler8997 commented 9 months ago

Here's my own take on a fix: https://github.com/xiph/rnnoise/pull/219

Relevant differences:

jmvalin commented 5 months ago

Can you give the upgrade1 branch a try. The VLAs should all be replaced with fixes sizes.