diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-12 04:49:03 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-12 04:49:03 +0000 |
| commit | a31ccd8c3dc87010ab44cac6027477b62ec446b3 (patch) | |
| tree | 340291d6530c13a962f2545b81e0980080984efc /util/spkmodem_recv | |
| parent | 44c6b453bc3c59961008956fbf221899bac2991c (diff) | |
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 <leah@libreboot.org>
Diffstat (limited to 'util/spkmodem_recv')
| -rw-r--r-- | util/spkmodem_recv/spkmodem-recv.c | 22 |
1 files 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 |
