Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
f619a7be
Commit
f619a7be
authored
Nov 19, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize factor -> db conversions, this improves decoding speed.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
b0c51b6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
audiowmark.cc
src/audiowmark.cc
+12
-1
No files found.
src/audiowmark.cc
View file @
f619a7be
...
@@ -224,12 +224,23 @@ window_hamming (double x) /* sharp (rectangle) cutoffs at boundaries */
...
@@ -224,12 +224,23 @@ window_hamming (double x) /* sharp (rectangle) cutoffs at boundaries */
return
0.54
+
0.46
*
cos
(
M_PI
*
x
);
return
0.54
+
0.46
*
cos
(
M_PI
*
x
);
}
}
/*
* glibc log2f is a lot faster than glibc log10
*/
inline
double
log10_approx
(
double
l
)
{
constexpr
double
log2_log10_factor
=
0.3010299956639811952
;
// 1 / log2 (10)
return
log2f
(
l
)
*
log2_log10_factor
;
}
double
double
db_from_factor
(
double
factor
,
double
min_dB
)
db_from_factor
(
double
factor
,
double
min_dB
)
{
{
if
(
factor
>
0
)
if
(
factor
>
0
)
{
{
double
dB
=
log10
(
factor
);
/* Bell */
double
dB
=
log10
_approx
(
factor
);
/* Bell */
dB
*=
20
;
dB
*=
20
;
return
dB
;
return
dB
;
}
}
...
...
Write
Preview
Markdown
is supported
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