Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tim-Philipp Müller
Opus
Commits
aa32042a
Commit
aa32042a
authored
Jul 15, 2016
by
Jean-Marc Valin
Browse files
Slightly increase the safety margin for opus_pcm_soft_clip()
No values outside of +/-1 detected now.
parent
bca70b87
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/opus.c
View file @
aa32042a
...
...
@@ -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^-2
4
. This is just enough to ensure -ffast-math
/* Slightly boost "a" by 2^-2
2
. 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
*
6
e-
8
;
a
+=
a
*
2.4
e-
7
;
if
(
x
[
i
*
C
]
>
0
)
a
=
-
a
;
/* Apply soft clipping */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment