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
Mark Harris
Opus
Commits
58b3727f
Commit
58b3727f
authored
Aug 30, 2008
by
Jean-Marc Valin
Browse files
exp() and log() are faster than pow() and log10() for dB conversion
parent
c994394f
Changes
1
Hide whitespace changes
Inline
Side-by-side
libcelt/quant_bands.c
View file @
58b3727f
...
...
@@ -71,14 +71,16 @@ static inline celt_word16_t amp2dB(celt_ener_t amp)
static
inline
celt_ener_t
dB2Amp
(
celt_ener_t
dB
)
{
celt_ener_t
amp
;
amp
=
pow
(
10
,
.
05
*
dB
)
-
.
3
;
/*amp = pow(10, .05*dB)-.3;*/
amp
=
exp
(
0
.
115129
f
*
dB
)
-
.
3
f
;
if
(
amp
<
0
)
amp
=
0
;
return
amp
;
}
static
inline
celt_word16_t
amp2dB
(
celt_ener_t
amp
)
{
return
20
*
log10
(.
3
+
amp
);
/*return 20*log10(.3+amp);*/
return
8
.
68589
f
*
log
(.
3
f
+
amp
);
}
#endif
...
...
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