lucianodato / libspecbleach

C library for audio noise reduction and other spectral effects
GNU Lesser General Public License v2.1
68 stars 12 forks source link

Smoothing #35

Closed SimonG4ELI closed 2 years ago

SimonG4ELI commented 2 years ago

Would it be possible to explain the smoothing factor? Changing this in adaptive mode appears to make no difference. Many thanks, Simon.

lucianodato commented 2 years ago

What do you think of the new description? Just to let you know, I have planned to do video tutorials for noise repellent which uses libspecbleach explaining what is behind of each of the parameters.

SimonG4ELI commented 2 years ago

The new description is good. I'm currently writing fft_transform to use Intel IPP DFT as I cannot use FFTW. When I have done this I'll make you a video.

My website is https://www.g4eli.com and my software is https://www.sdr-radio.com.

lucianodato commented 2 years ago

I'm glad that you find it useful! Really cool I used to be an amateur radio guy myself when I was a kid. LU8FLE was my license back then but no longer is of course. Do you feel that the intel dft could be incorporated back as optional or is really specific to your software?

SimonG4ELI commented 2 years ago

Intel's DFT could be used as an alternative to FFTW if there are licensing problems as FFTW is GPL2.

FFT overhead is not a big problem here, I'm sure there must be alternatives but I use Intel's IPP anyway so use the DFT.

SimonG4ELI commented 2 years ago

OK, I have the Intel DFT working, as expected the result is identical to FFTW. I suggest you stay with FFTW for now and I can help if you want to use the Intel IPP library later. For a multi-platform solution I would even consider a simple FFT implementation, bandwidth is low and load will not be high.

Now for that memory issue, if your fixes don't help I'll put lots of array bound checks and find it myself.

lucianodato commented 2 years ago

Well I've been using valgrind and gcc's address sanitizer but couldn't really find anything. Not sure what I'm doing wrong. Valgrind reports some still reachable memory but from what I've been reading is not a big deal or maybe it is. Would mind your help here, I'm certainly not a C/C++ expert.

SimonG4ELI commented 2 years ago

OK, I'll get your latest code, if it still has memory issues I'll put in lots of assert checks for out of bound access etc.

SimonG4ELI commented 2 years ago

Bug Found in masking_estimator.c. In the code below at line 169 k can be > the allocated size for float* masking_thresholds. Adding the sanity check solves the memory corruption. My input sample rate is 8kHz, this depends on whether I'm processing SSB, AM or FM audio - different bandwidths for each mode.

When I close the process in debug mode Visual Studio no longer reports memory heap corruption.


for (uint32_t k = self->band_indexes.start_position;
     k < self->band_indexes.end_position; k++) {

    //
    //  SJB k can be > self->real_spectrum_size (81) so add sanity check.
    //
     if (k < self->real_spectrum_size)
         masking_thresholds[k] = self->threshold_j[j];
}
lucianodato commented 2 years ago

Thank you very much Simon! I'll take a look this afternoon.