]> 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)
committermkmer <m_kasper@sbcglobal.net>
Fri, 27 Jun 2025 15:38:28 +0000 (15:38 +0000)
commit6d06d1765fcc7d8a8acf03ffbe2c12021b5ea62d
tree6bf05b2a630ed547689032532d3d904323ea1c97
parentbf9a6d80f8ad2ba438783eba7077e073d1fa409f
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
include/asterisk/utils.h