util/spkmodem-recv: optimise decode_pulse

the frame[] array is never actually used meaningfully.

that setting of frame[ringpos] on the decode_state is
only set here, but then the value isn't really used at
all. the entire size of the annay is used for sizeof
in print_stats, but then we can just declare that
manually. since we also know that this value never
changes, we can use a global define for the sizeof entry
in print_stats, thereby simplifying operation further

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-12 19:48:23 +00:00
parent a7c69c3233
commit 9f41591a46
+2 -3
View File
@@ -39,6 +39,7 @@
#define SAMPLES_PER_FRAME 240
#define MAX_SAMPLES (2 * SAMPLES_PER_FRAME)
#define SAMPLE_OFFSET (MAX_SAMPLES * sizeof(short))
#define FREQ_SEP_MIN 5
#define FREQ_SEP_MAX 15
@@ -52,7 +53,6 @@
#define READ_BUF 4096
struct decoder_state {
signed short frame[MAX_SAMPLES];
unsigned char pulse[MAX_SAMPLES];
signed short inbuf[READ_BUF];
@@ -192,7 +192,6 @@ decode_pulse(struct decoder_state *st)
st->freq_separator -= old_sep;
sample = read_sample(st);
st->frame[ringpos] = sample;
if ((unsigned)(sample + THRESHOLD)
> (unsigned)(2 * THRESHOLD))
@@ -291,7 +290,7 @@ print_stats(struct decoder_state *st)
st->freq_data,
st->freq_separator,
FREQ_DATA_THRESHOLD,
pos - sizeof(st->frame));
pos - SAMPLE_OFFSET);
}
static void