Allow FFTW to destroy input arrays
Since they're scratch buffers anyways.
This commit is contained in:
parent
da1e850722
commit
be39e19365
3 changed files with 19 additions and 5 deletions
|
@ -75,7 +75,11 @@ impl SpectrumInput {
|
||||||
spectrum_result_buffer: [0.0; SPECTRUM_WINDOW_SIZE / 2],
|
spectrum_result_buffer: [0.0; SPECTRUM_WINDOW_SIZE / 2],
|
||||||
|
|
||||||
plan: Plan {
|
plan: Plan {
|
||||||
r2c_plan: R2CPlan32::aligned(&[SPECTRUM_WINDOW_SIZE], Flag::MEASURE).unwrap(),
|
r2c_plan: R2CPlan32::aligned(
|
||||||
|
&[SPECTRUM_WINDOW_SIZE],
|
||||||
|
Flag::MEASURE | Flag::DESTROYINPUT,
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
},
|
},
|
||||||
compensated_window_function: util::window::hann(SPECTRUM_WINDOW_SIZE)
|
compensated_window_function: util::window::hann(SPECTRUM_WINDOW_SIZE)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
|
@ -40,8 +40,10 @@ struct StftParams {}
|
||||||
|
|
||||||
impl Default for Stft {
|
impl Default for Stft {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let mut r2c_plan: R2CPlan32 = R2CPlan32::aligned(&[WINDOW_SIZE], Flag::MEASURE).unwrap();
|
let mut r2c_plan: R2CPlan32 =
|
||||||
let c2r_plan: C2RPlan32 = C2RPlan32::aligned(&[WINDOW_SIZE], Flag::MEASURE).unwrap();
|
R2CPlan32::aligned(&[WINDOW_SIZE], Flag::MEASURE | Flag::DESTROYINPUT).unwrap();
|
||||||
|
let c2r_plan: C2RPlan32 =
|
||||||
|
C2RPlan32::aligned(&[WINDOW_SIZE], Flag::MEASURE | Flag::DESTROYINPUT).unwrap();
|
||||||
let mut real_fft_scratch_buffer: AlignedVec<f32> = AlignedVec::new(WINDOW_SIZE);
|
let mut real_fft_scratch_buffer: AlignedVec<f32> = AlignedVec::new(WINDOW_SIZE);
|
||||||
let mut complex_fft_scratch_buffer: AlignedVec<c32> = AlignedVec::new(WINDOW_SIZE / 2 + 1);
|
let mut complex_fft_scratch_buffer: AlignedVec<c32> = AlignedVec::new(WINDOW_SIZE / 2 + 1);
|
||||||
|
|
||||||
|
|
|
@ -179,8 +179,16 @@ impl Plugin for PubertySimulator {
|
||||||
// that's good enough for now. An alternative would be to replan on a worker thread,
|
// that's good enough for now. An alternative would be to replan on a worker thread,
|
||||||
// but this makes switching between window sizes a bit cleaner.
|
// but this makes switching between window sizes a bit cleaner.
|
||||||
.map(|order| Plan {
|
.map(|order| Plan {
|
||||||
r2c_plan: R2CPlan32::aligned(&[1 << order], Flag::ESTIMATE).unwrap(),
|
r2c_plan: R2CPlan32::aligned(
|
||||||
c2r_plan: C2RPlan32::aligned(&[1 << order], Flag::ESTIMATE).unwrap(),
|
&[1 << order],
|
||||||
|
Flag::ESTIMATE | Flag::DESTROYINPUT,
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
|
c2r_plan: C2RPlan32::aligned(
|
||||||
|
&[1 << order],
|
||||||
|
Flag::ESTIMATE | Flag::DESTROYINPUT,
|
||||||
|
)
|
||||||
|
.unwrap(),
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
self.plan_for_order = Some(
|
self.plan_for_order = Some(
|
||||||
|
|
Loading…
Add table
Reference in a new issue