]> git.ipfire.org Git - thirdparty/asterisk.git/commit
utils.h: Add rounding to float conversion to int.
authormkmer <m_kasper@sbcglobal.net>
Mon, 24 Mar 2025 01:04:50 +0000 (21:04 -0400)
committerAsterisk Development Team <asteriskteam@digium.com>
Wed, 10 Sep 2025 19:52:59 +0000 (19:52 +0000)
commitbd462f07750ceb2ee2e9cc5d6f8f45949c12c274
tree8383dafa29c6685d0ecdc78ea23e33c34bab1dcf
parent57340d50bfe92ec453604f7752bf225e3e6d2c94
utils.h: Add rounding to float conversion to int.

Quote from an audio engineer NR9V:
There is a minor issue of a small amount of crossover distortion though as a result of `ast_slinear_saturated_multiply_float()` not rounding the float. This could result in some quiet but potentially audible distortion artifacts in lower volume parts of the signal. If you have for example a sign wave function with a max amplitude of just a few samples, all samples between -1 and 1 will be truncated to zero, resulting in the waveform no longer being a sine wave and in harmonic distortion.

Resolves: #1176
(cherry picked from commit 55f4294e821fef183db71bf2f897d906c808670e)
include/asterisk/utils.h