Hi, I think I found a bug with the USB/LSB mode of RTL-FM. I can hear either type of transmission correctly, but it doesn’t matter which one I use - as both are audible through the same settings. I’m quite sure that it’s due to the low-pass (which is a rectangular window) not applying a hilbert transform to either channel. Since the hilbert transform of the sinc sin(t)/t is (1-cos(t))/t, that should be easy enough to fix by actually doing the lowpass step correctly, however I would probably suspect we’d only like to use the hilbert form of the sinc when necessary?
void full_demod(struct demod_state *d)
{
int i, ds_p;
int sr = 0;
ds_p = d->downsample_passes;
if (ds_p) {
for (i=0; i < ds_p; i++) {
fifth_order(d->lowpassed, (d->lp_len >> i), d->lp_i_hist[i]);
fifth_order(d->lowpassed+1, (d->lp_len >> i) - 1, d->lp_q_hist[i]);
}
d->lp_len = d->lp_len >> ds_p;
/* droop compensation */
if (d->comp_fir_size == 9 && ds_p <= CIC_TABLE_MAX) {
generic_fir(d->lowpassed, d->lp_len,
cic_9_tables[ds_p], d->droop_i_hist);
generic_fir(d->lowpassed+1, d->lp_len-1,
cic_9_tables[ds_p], d->droop_q_hist);
}
} else {
low_pass(d);
}
/* power squelch */
if (d->squelch_level) {
sr = rms(d->lowpassed, d->lp_len, 1);
if (sr < d->squelch_level) {
d->squelch_hits++;
for (i=0; i<d->lp_len; i++) {
d->lowpassed[i] = 0;
}
} else {
d->squelch_hits = 0;}
}
d->mode_demod(d); /* lowpassed -> result */