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
91697333
Commit
91697333
authored
Dec 15, 2018
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move windowing code out of the inner compute_frame_ffts loop.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
9db6c5e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
audiowmark.cc
src/audiowmark.cc
+23
-14
No files found.
src/audiowmark.cc
View file @
91697333
...
@@ -362,27 +362,36 @@ compute_frame_ffts (const WavData& wav_data)
...
@@ -362,27 +362,36 @@ compute_frame_ffts (const WavData& wav_data)
{
{
vector
<
vector
<
complex
<
float
>>>
fft_out
;
vector
<
vector
<
complex
<
float
>>>
fft_out
;
/* generate analysis window */
vector
<
float
>
window
(
Params
::
frame_size
);
double
window_weight
=
0
;
for
(
size_t
i
=
0
;
i
<
Params
::
frame_size
;
i
++
)
{
const
double
fsize_2
=
Params
::
frame_size
/
2.0
;
// const double win = window_cos ((i - fsize_2) / fsize_2);
const
double
win
=
window_hamming
((
i
-
fsize_2
)
/
fsize_2
);
//const double win = 1;
window
[
i
]
=
win
;
window_weight
+=
win
;
}
/* normalize window using window weight */
for
(
size_t
i
=
0
;
i
<
Params
::
frame_size
;
i
++
)
{
window
[
i
]
*=
2.0
/
window_weight
;
}
for
(
int
f
=
0
;
f
<
frame_count
(
wav_data
);
f
++
)
for
(
int
f
=
0
;
f
<
frame_count
(
wav_data
);
f
++
)
{
{
for
(
int
ch
=
0
;
ch
<
wav_data
.
n_channels
();
ch
++
)
for
(
int
ch
=
0
;
ch
<
wav_data
.
n_channels
();
ch
++
)
{
{
vector
<
float
>
frame
=
get_frame
(
wav_data
,
f
,
ch
);
vector
<
float
>
frame
=
get_frame
(
wav_data
,
f
,
ch
);
/* windowing */
/* apply window */
double
window_weight
=
0
;
for
(
size_t
i
=
0
;
i
<
frame
.
size
();
i
++
)
{
const
double
fsize_2
=
frame
.
size
()
/
2.0
;
// const double win = window_cos ((i - fsize_2) / fsize_2);
const
double
win
=
window_hamming
((
i
-
fsize_2
)
/
fsize_2
);
//const double win = 1;
frame
[
i
]
*=
win
;
window_weight
+=
win
;
}
/* to get normalized fft output corrected by window weight */
for
(
size_t
i
=
0
;
i
<
frame
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
frame
.
size
();
i
++
)
frame
[
i
]
*=
2.0
/
window_weight
;
frame
[
i
]
*=
window
[
i
]
;
/* FFT transform */
/* FFT transform */
fft_out
.
push_back
(
fft
(
frame
));
fft_out
.
push_back
(
fft
(
frame
));
...
...
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