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>
This commit is contained in:
Leah Rowe
2026-03-12 04:49:03 +00:00
parent 44c6b453bc
commit a31ccd8c3d

View File

@@ -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)) {
if (set_ascii_bit(st) < 0)
print_char(st);
st->sample_count = 0;
for (sample = 0; sample < SAMPLES_PER_FRAME; sample++)
decode_pulse(st);
} else {
decode_pulse(st);
return;
}
if (set_ascii_bit(st) < 0)
print_char(st);
st->sample_count = 0;
for (sample = 0; sample < SAMPLES_PER_FRAME; sample++)
decode_pulse(st);
}
static void