dbdexter-dev / sondedump

Extensible radiosonde decoder
MIT License
11 stars 2 forks source link

segmentation fault in demod/dsp/filter.c #1

Closed ra1nb0w closed 2 years ago

ra1nb0w commented 2 years ago

Hi, trying to decode the attached wav file I encountered the following segmentation fault. It happens on Linux and macOS. Compiling with debug CMAKE_BUILD_TYPE=Debug the segmentation doesn't happen. Maybe a timing issue?

Just a side question: do you know a way to improve the SNR of the wav and re-align the frequency? Unfortunately, I didn't saved the I/Q.

Anyway, thank you very much for this tool! /davide

Program received signal SIGSEGV, Segmentation fault.
0x00005555555617ef in filter_fwd_sample (flt=flt@entry=0x555555584360, sample=-9.21157125e+33) at /home/rainbow/sources/sondedump/demod/dsp/filter.c:44
44      flt->mem[flt->idx] = flt->mem[flt->idx + flt->size] = sample;
(gdb) bt
#0  0x00005555555617ef in filter_fwd_sample (flt=flt@entry=0x555555584360, sample=-9.21157125e+33)
    at /home/rainbow/sources/sondedump/demod/dsp/filter.c:44
#1  0x0000555555560ce6 in gfsk_demod (g=0x555555584350, dst=0x555555584450 "", bit_offset=0x555555584860, count=4144, 
    src=0x7fffffffd680, len=1024) at /home/rainbow/sources/sondedump/demod/gfsk.c:80
#2  0x000055555555f8bd in framer_demod_internal (len=1024, src=0x7fffffffd680, framelen=4144, 
    bit_offset=0x555555584860, dst=0x555555584450 "", f=0x555555584350)
    at /home/rainbow/sources/sondedump/decode/framer.c:88
#3  framer_read (f=f@entry=0x555555584350, dst=dst@entry=0x555555584450 "", 
    bit_offset=bit_offset@entry=0x555555584860, framelen=framelen@entry=4144, src=src@entry=0x7fffffffd680, len=1024)
    at /home/rainbow/sources/sondedump/decode/framer.c:43
#4  0x0000555555558f2f in rs41_decode (self=0x555555584350, dst=dst@entry=0x7fffffffd540, 
    src=src@entry=0x7fffffffd680, len=len@entry=1024) at /home/rainbow/sources/sondedump/sonde/rs41/rs41.c:161
#5  0x00005555555583fd in decode (srcbuf=srcbuf@entry=0x7fffffffd680, len=len@entry=1024)
    at /home/rainbow/sources/sondedump/decode.c:105
#6  0x00005555555567dd in main (argc=<optimized out>, argv=<optimized out>)
    at /home/rainbow/sources/sondedump/main.c:274

samples.zip

dbdexter-dev commented 2 years ago

Hi, Thank you for the samples and GDB trace. Guess I broke file input when playing around with input from audio devices, and the samplerate was not being initialized. Should be fixed with the latest commit, let me know if the issue persists.

Once the signal is decoded into audio, there's not much you can do to improve the SNR. With the IQ you can optimize the bandwidth of the decoder so that it covers the entire signal and not much more. Some SDR software can also do noise reduction at the IF level, which can help with noise quite a bit, but again, that requires the original IQ recording unfortunately

ra1nb0w commented 2 years ago

fixed. thank you.

Next time, I will use gqrx to save iq to easily do whatever I want.

have a great day