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
b58469d5
Commit
b58469d5
authored
Feb 16, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize limiter performance by interpolating scale factor directly.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
83aab16e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
5 deletions
+4
-5
TODO
src/TODO
+0
-1
limiter.cc
src/limiter.cc
+3
-3
testlimiter.cc
src/testlimiter.cc
+1
-1
No files found.
src/TODO
View file @
b58469d5
...
...
@@ -3,4 +3,3 @@ possible improvements:
limiter:
- flush
- interpolate scale factor directly
src/limiter.cc
View file @
b58469d5
...
...
@@ -61,12 +61,12 @@ Limiter::process_block (const float *in, float *out)
block_max
=
max
(
block_max
,
fabs
(
in
[
x
]));
block_max2
=
max
(
block_max2
,
fabs
(
in
[
x
+
block_size
*
n_channels
]));
}
float
left_max
=
max
(
last_block_max
,
block_max
);
float
right_max
=
max
(
block_max
,
block_max2
);
const
float
scale_start
=
ceiling
/
max
(
last_block_max
,
block_max
);
const
float
scale_end
=
ceiling
/
max
(
block_max
,
block_max2
);
for
(
size_t
i
=
0
;
i
<
block_size
;
i
++
)
{
const
float
alpha
=
float
(
i
)
/
block_size
;
const
float
scale
=
ceiling
/
(
left_max
*
(
1
-
alpha
)
+
right_max
*
alpha
)
;
const
float
scale
=
scale_start
*
(
1
-
alpha
)
+
scale_end
*
alpha
;
// debug_scale (scale);
for
(
uint
c
=
0
;
c
<
n_channels
;
c
++
)
...
...
src/testlimiter.cc
View file @
b58469d5
...
...
@@ -50,7 +50,7 @@ int
impulses
()
{
Limiter
limiter
(
2
,
44100
);
limiter
.
set_block_size_ms
(
5
);
limiter
.
set_block_size_ms
(
3
);
limiter
.
set_ceiling
(
0.9
);
vector
<
float
>
in_all
,
out_all
;
...
...
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