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
dfb14ab1
Commit
dfb14ab1
authored
Dec 11, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid creating a plan for the same size more than once in FFTProcessor.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
7e4dc0a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
TODO
src/TODO
+0
-2
fft.cc
src/fft.cc
+14
-2
No files found.
src/TODO
View file @
dfb14ab1
speed detection:
speed detection:
- fft planner should only run once per size
- double decode
- double decode
- propagate debug flag from "cmp" to speed detect
- propagate debug flag from "cmp" to speed detect
- rename methods => add_search_jobs()...
- rename methods => add_search_jobs()...
...
@@ -7,7 +6,6 @@ speed detection:
...
@@ -7,7 +6,6 @@ speed detection:
- maybe truncate cleanup
- maybe truncate cleanup
- SpeedSync should take struct arg
- SpeedSync should take struct arg
- remove pad start scaling
- remove pad start scaling
- move get speed clip to speed_scan
- average speed if more than one best-quality 50s estimate is produced
- average speed if more than one best-quality 50s estimate is produced
- test code
- test code
- document in README
- document in README
...
...
src/fft.cc
View file @
dfb14ab1
...
@@ -27,6 +27,8 @@ using std::complex;
...
@@ -27,6 +27,8 @@ using std::complex;
using
std
::
map
;
using
std
::
map
;
static
std
::
mutex
fft_planner_mutex
;
static
std
::
mutex
fft_planner_mutex
;
static
std
::
map
<
size_t
,
fftwf_plan
>
fft_plan_map
;
static
std
::
map
<
size_t
,
fftwf_plan
>
ifft_plan_map
;
FFTProcessor
::
FFTProcessor
(
size_t
N
)
FFTProcessor
::
FFTProcessor
(
size_t
N
)
{
{
...
@@ -37,8 +39,18 @@ FFTProcessor::FFTProcessor (size_t N)
...
@@ -37,8 +39,18 @@ FFTProcessor::FFTProcessor (size_t N)
m_in
=
static_cast
<
float
*>
(
fftwf_malloc
(
sizeof
(
float
)
*
N_2
));
m_in
=
static_cast
<
float
*>
(
fftwf_malloc
(
sizeof
(
float
)
*
N_2
));
m_out
=
static_cast
<
float
*>
(
fftwf_malloc
(
sizeof
(
float
)
*
N_2
));
m_out
=
static_cast
<
float
*>
(
fftwf_malloc
(
sizeof
(
float
)
*
N_2
));
plan_fft
=
fftwf_plan_dft_r2c_1d
(
N
,
m_in
,
(
fftwf_complex
*
)
m_out
,
FFTW_ESTIMATE
|
FFTW_PRESERVE_INPUT
);
/* plan if not done already */
plan_ifft
=
fftwf_plan_dft_c2r_1d
(
N
,
(
fftwf_complex
*
)
m_in
,
m_out
,
FFTW_ESTIMATE
|
FFTW_PRESERVE_INPUT
);
fftwf_plan
&
pfft
=
fft_plan_map
[
N
];
if
(
!
pfft
)
pfft
=
fftwf_plan_dft_r2c_1d
(
N
,
m_in
,
(
fftwf_complex
*
)
m_out
,
FFTW_ESTIMATE
|
FFTW_PRESERVE_INPUT
);
fftwf_plan
&
pifft
=
ifft_plan_map
[
N
];
if
(
!
pifft
)
pifft
=
fftwf_plan_dft_c2r_1d
(
N
,
(
fftwf_complex
*
)
m_in
,
m_out
,
FFTW_ESTIMATE
|
FFTW_PRESERVE_INPUT
);
/* store plan for size N as member variables */
plan_fft
=
pfft
;
plan_ifft
=
pifft
;
// we could add code for saving plans here, and use patient planning
// we could add code for saving plans here, and use patient planning
}
}
...
...
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