]> 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:55:23 +0000 (19:55 +0000)
commitf35fe5ce8c5a8eadb40ea0846e15ee9811366ea8
treed7ad6e0ca595d5842f8ca4eb47bfc09e6fef792e
parent30aea937aaea0756d976f8686d836064b02621b2
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 e63d87a06448e4efe4823382fe533c0c5781f268)
include/asterisk/utils.h