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
0db0d742
Commit
0db0d742
authored
Nov 19, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanups in sync_fft().
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
c328ca5d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
audiowmark.cc
src/audiowmark.cc
+8
-9
No files found.
src/audiowmark.cc
View file @
0db0d742
...
@@ -1284,31 +1284,30 @@ public:
...
@@ -1284,31 +1284,30 @@ public:
}
}
private
:
private
:
void
void
sync_fft
(
const
WavData
&
wav_data
,
size_t
index
,
size_t
count
,
vector
<
float
>&
fft_out_db
,
const
vector
<
int
>&
want_frames
)
sync_fft
(
const
WavData
&
wav_data
,
size_t
index
,
size_t
frame_
count
,
vector
<
float
>&
fft_out_db
,
const
vector
<
int
>&
want_frames
)
{
{
FFTAnalyzer
fft_analyzer
(
wav_data
.
n_channels
());
FFTAnalyzer
fft_analyzer
(
wav_data
.
n_channels
());
const
vector
<
float
>&
samples
=
wav_data
.
samples
();
const
vector
<
float
>&
samples
=
wav_data
.
samples
();
/* read past end? -> fail */
if
(
wav_data
.
n_values
()
<
(
index
+
frame_count
*
Params
::
frame_size
)
*
wav_data
.
n_channels
())
return
;
fft_out_db
.
clear
();
fft_out_db
.
clear
();
/* computing db-magnitude is expensive, so we better do it here */
/* computing db-magnitude is expensive, so we better do it here */
vector
<
vector
<
complex
<
float
>>>
fft_out
;
vector
<
vector
<
complex
<
float
>>>
fft_out
;
for
(
size_t
f
=
0
;
f
<
count
;
f
++
)
for
(
size_t
f
=
0
;
f
<
frame_
count
;
f
++
)
{
{
const
size_t
input_start
=
(
index
+
f
*
Params
::
frame_size
)
*
wav_data
.
n_channels
();
if
(
want_frames
.
size
()
&&
!
want_frames
[
f
])
const
size_t
input_end
=
input_start
+
Params
::
frame_size
*
wav_data
.
n_channels
();
if
(
input_end
>
samples
.
size
()
||
(
want_frames
.
size
()
&&
!
want_frames
[
f
]))
{
{
for
(
int
ch
=
0
;
ch
<
wav_data
.
n_channels
();
ch
++
)
for
(
int
ch
=
0
;
ch
<
wav_data
.
n_channels
();
ch
++
)
fft_out
.
push_back
({});
fft_out
.
push_back
({});
}
}
else
else
{
{
vector
<
float
>
input
(
samples
.
begin
()
+
input_start
,
samples
.
begin
()
+
input_end
);
vector
<
vector
<
complex
<
float
>>>
frame_result
=
fft_analyzer
.
run_fft
(
samples
,
index
+
f
*
Params
::
frame_size
);
vector
<
vector
<
complex
<
float
>>>
frame_result
=
fft_analyzer
.
run_fft
(
input
,
0
);
for
(
auto
&
fr
:
frame_result
)
for
(
auto
&
fr
:
frame_result
)
fft_out
.
emplace_back
(
std
::
move
(
fr
));
fft_out
.
emplace_back
(
std
::
move
(
fr
));
}
}
...
...
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