Allow FFTW to destroy input arrays
Since they're scratch buffers anyways.
This commit is contained in:
parent
da1e850722
commit
be39e19365
|
@ -75,7 +75,11 @@ impl SpectrumInput {
|
|||
spectrum_result_buffer: [0.0; SPECTRUM_WINDOW_SIZE / 2],
|
||||
|
||||
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)
|
||||
.into_iter()
|
||||
|
|
|
@ -40,8 +40,10 @@ struct StftParams {}
|
|||
|
||||
impl Default for Stft {
|
||||
fn default() -> Self {
|
||||
let mut r2c_plan: R2CPlan32 = R2CPlan32::aligned(&[WINDOW_SIZE], Flag::MEASURE).unwrap();
|
||||
let c2r_plan: C2RPlan32 = C2RPlan32::aligned(&[WINDOW_SIZE], Flag::MEASURE).unwrap();
|
||||
let mut r2c_plan: R2CPlan32 =
|
||||
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 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,
|
||||
// but this makes switching between window sizes a bit cleaner.
|
||||
.map(|order| Plan {
|
||||
r2c_plan: R2CPlan32::aligned(&[1 << order], Flag::ESTIMATE).unwrap(),
|
||||
c2r_plan: C2RPlan32::aligned(&[1 << order], Flag::ESTIMATE).unwrap(),
|
||||
r2c_plan: R2CPlan32::aligned(
|
||||
&[1 << order],
|
||||
Flag::ESTIMATE | Flag::DESTROYINPUT,
|
||||
)
|
||||
.unwrap(),
|
||||
c2r_plan: C2RPlan32::aligned(
|
||||
&[1 << order],
|
||||
Flag::ESTIMATE | Flag::DESTROYINPUT,
|
||||
)
|
||||
.unwrap(),
|
||||
})
|
||||
.collect();
|
||||
self.plan_for_order = Some(
|
||||
|
|
Loading…
Reference in a new issue