From a31ccd8c3dc87010ab44cac6027477b62ec446b3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 12 Mar 2026 04:49:03 +0000 Subject: util/spkmodem-recv: tidy up handle_audio frame handling, error checks, pulse decoding and character decoding are all jumbled up. this patch separates them a bit, making it clearer. should also help codegen. this tool is dealing with high bandwidth text, which on slower computers may be cumbersome. every optimisation counts. not really relevant on newer systems. Signed-off-by: Leah Rowe --- util/spkmodem_recv/spkmodem-recv.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c index 58275979..29832919 100644 --- a/util/spkmodem_recv/spkmodem-recv.c +++ b/util/spkmodem_recv/spkmodem-recv.c @@ -123,22 +123,22 @@ handle_audio(struct decoder_state *st) if (st->sample_count > (3 * SAMPLES_PER_FRAME)) reset_char(st); - if ((st->freq_separator <= FREQ_SEP_MIN) || - (st->freq_separator >= FREQ_SEP_MAX) || - (st->freq_data <= FREQ_DATA_MIN) || - (st->freq_data >= FREQ_DATA_MAX)) { + if ((st->freq_separator > FREQ_SEP_MIN) && + (st->freq_separator < FREQ_SEP_MAX) && + (st->freq_data > FREQ_DATA_MIN) && + (st->freq_data < FREQ_DATA_MAX)) { - decode_pulse(st); - return; - } + if (set_ascii_bit(st) < 0) + print_char(st); - if (set_ascii_bit(st) < 0) - print_char(st); + st->sample_count = 0; - st->sample_count = 0; + for (sample = 0; sample < SAMPLES_PER_FRAME; sample++) + decode_pulse(st); - for (sample = 0; sample < SAMPLES_PER_FRAME; sample++) + } else { decode_pulse(st); + } } static void -- cgit v1.2.1