]> 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)
committerGeorge Joseph <gjoseph@sangoma.com>
Wed, 17 Sep 2025 19:36:50 +0000 (13:36 -0600)
commit1e7402dd37b8ca61b1877ef9a35111406a0c1267
tree6690999a084b60550ece59dda2101fec65e19175
parentac1e1adb991fc7090c461d4c70050400123adaef
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