mirror of
https://github.com/xiph/opus.git
synced 2025-06-06 15:30:48 +00:00
Slightly increase the safety margin for opus_pcm_soft_clip()
No values outside of +/-1 detected now.
This commit is contained in:
parent
bca70b87ef
commit
aa32042a50
1 changed files with 2 additions and 2 deletions
|
@ -104,10 +104,10 @@ OPUS_EXPORT void opus_pcm_soft_clip(float *_x, int N, int C, float *declip_mem)
|
||||||
|
|
||||||
/* Compute a such that maxval + a*maxval^2 = 1 */
|
/* Compute a such that maxval + a*maxval^2 = 1 */
|
||||||
a=(maxval-1)/(maxval*maxval);
|
a=(maxval-1)/(maxval*maxval);
|
||||||
/* Slightly boost "a" by 2^-24. This is just enough to ensure -ffast-math
|
/* Slightly boost "a" by 2^-22. This is just enough to ensure -ffast-math
|
||||||
does not cause output values larger than +/-1, but small enough not
|
does not cause output values larger than +/-1, but small enough not
|
||||||
to matter even for 24-bit output. */
|
to matter even for 24-bit output. */
|
||||||
a += a*6e-8;
|
a += a*2.4e-7;
|
||||||
if (x[i*C]>0)
|
if (x[i*C]>0)
|
||||||
a = -a;
|
a = -a;
|
||||||
/* Apply soft clipping */
|
/* Apply soft clipping */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue