]> 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 17:40:37 +0000 (11:40 -0600)
commit798fd4eb63f495d0026395abca1fa38ee5f2d60b
treedf637c2cad2884c203d27e2277786429dabe2cad
parent9803156223b8b2bddf7365c9c42bab0faf9bcd21
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 6d06d1765fcc7d8a8acf03ffbe2c12021b5ea62d)
include/asterisk/utils.h