From 1533422f982b66b340da26357608cb479b3ff7dd Mon Sep 17 00:00:00 2001 From: Kyle Keen Date: Tue, 4 Sep 2012 22:01:17 -0400 Subject: [PATCH] rtl_fm: half the oversample bugs Signed-off-by: Steve Markgraf --- src/rtl_fm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/rtl_fm.c b/src/rtl_fm.c index c1162dc..df7d768 100644 --- a/src/rtl_fm.c +++ b/src/rtl_fm.c @@ -86,7 +86,7 @@ struct fm_state int signal_len; FILE *file; int edge; - uint32_t freqs[32]; + uint32_t freqs[100]; int freq_len; int freq_now; uint32_t sample_rate; @@ -236,8 +236,9 @@ int low_pass_simple(int16_t *signal2, int len, int step) for(i2=0; i2signal2[i/2] = 0; + fm->signal2[i] = 0; } return 0; } @@ -396,7 +397,7 @@ void full_demod(unsigned char *buf, uint32_t len, struct fm_state *fm) fm_demod(fm); sr = post_squelch(fm); if (fm->post_downsample > 1) { - fm->signal_len = low_pass_simple(fm->signal2, fm->signal_len, fm->post_downsample);} + fm->signal_len = low_pass_simple(fm->signal2, fm->signal_len/2, fm->post_downsample)*2;} /* ignore under runs for now */ fwrite(fm->signal2, 2, fm->signal_len/2, fm->file); if (fm->freq_len > 1 && !sr && fm->squelch_hits > CONSEQ_SQUELCH) { @@ -463,7 +464,7 @@ int main(int argc, char **argv) fm.edge = 0; fm.fir_enable = 0; fm.prev_index = -1; - fm.post_downsample = 1; + fm.post_downsample = 1; // once this works, default = 4 fm.custom_atan = 0; sem_init(&data_ready, 0, 0); @@ -505,7 +506,7 @@ int main(int argc, char **argv) break; } } - /* double sample_rate to limit to Δθ to ±π */ + /* quadruple sample_rate to limit to Δθ to ±π/2 */ fm.sample_rate *= fm.post_downsample; if (argc <= optind) {