Skip to content
Snippets Groups Projects
Commit aa32042a authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Slightly increase the safety margin for opus_pcm_soft_clip()

No values outside of +/-1 detected now.
parent bca70b87
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
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
to matter even for 24-bit output. */
a += a*6e-8;
a += a*2.4e-7;
if (x[i*C]>0)
a = -a;
/* Apply soft clipping */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment