diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-07-15 17:57:21 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-07-15 17:57:21 +0300 |
commit | bca70b87efc40595e2bb469d63c77618872bd97b (patch) | |
tree | e5f88245a0dccc253328f0ceaf79a4b8a5fd5eec /src/opus.c | |
parent | 6be769c3f3f05a9fa090ac8b8371cc4fa7cd1e1b (diff) |
Fixes opus_pcm_soft_clip() returning values slightly larger than +/-1 with -ffast-math
Diffstat (limited to 'src/opus.c')
-rw-r--r-- | src/opus.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -104,6 +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 + does not cause output values larger than +/-1, but small enough not + to matter even for 24-bit output. */ + a += a*6e-8; if (x[i*C]>0) a = -a; /* Apply soft clipping */ |