fix inputs to spectral_model

David Kleingeld created

Change summary

Cargo.toml                   | 1 +
crates/denoise/src/engine.rs | 6 +++---
crates/denoise/src/lib.rs    | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)

Detailed changes

Cargo.toml 🔗

@@ -781,6 +781,7 @@ codegen-units = 16
 
 [profile.dev.package]
 audio = { opt-level = 3 }
+denoise = { opt-level = 3 }
 taffy = { opt-level = 3 }
 cranelift-codegen = { opt-level = 3 }
 cranelift-codegen-meta = { opt-level = 3 }

crates/denoise/src/engine.rs 🔗

@@ -138,13 +138,13 @@ impl Engine {
 
         const SPECTRUM_INPUT: &str = "input_2";
         const MEMORY_INPUT: &str = "input_3";
-        let memory_input =
+        let spectrum =
             Tensor::from_slice::<_, f32>(&self.in_magnitude, (1, 1, FFT_OUT_SIZE), &Device::Cpu)
                 .expect("the in magnitude has enough elements to fill the Tensor");
 
         let inputs = HashMap::from([
-            (MEMORY_INPUT.to_string(), memory_input),
-            (SPECTRUM_INPUT.to_string(), self.spectral_memory.clone()),
+            (SPECTRUM_INPUT.to_string(), spectrum),
+            (MEMORY_INPUT.to_string(), self.spectral_memory.clone()),
         ]);
         inputs
     }

crates/denoise/src/lib.rs 🔗

@@ -264,6 +264,7 @@ impl<S: Source> Denoiser<S> {
     }
 }
 
+#[inline]
 fn read_sub_block(s: &mut impl Source) -> Option<[f32; BLOCK_SHIFT]> {
     let mut res = [0f32; BLOCK_SHIFT];
     for sample in &mut res {