audiorrnoise: Use correct value range for the samples

The nnnoiseless crate wants all samples in the range [-32767,32767]
instead of the [-1,1] range we're using for floating point samples.

Scale before/after processing while (de)interleaving the samples.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/276

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1003>
This commit is contained in:
Sebastian Dröge 2022-12-10 21:02:02 +02:00
parent 08c716d110
commit 1ffadbc270

View file

@ -92,7 +92,7 @@ impl State {
let channel_index = index % channels;
let channel_denoiser = &mut self.denoisers[channel_index];
let pos = index / channels;
channel_denoiser.frame_chunk[pos] = *item;
channel_denoiser.frame_chunk[pos] = *item * 32767.0;
}
for i in (in_frame.len() / channels)..(size / channels) {
@ -115,7 +115,7 @@ impl State {
let channel_index = index % channels;
let channel_denoiser = &self.denoisers[channel_index];
let pos = index / channels;
*item = channel_denoiser.out_chunk[pos];
*item = channel_denoiser.out_chunk[pos] / 32767.0;
}
}
}