T: hacks: plot-ofdm: handle more skipped samples

This commit is contained in:
Cedric Roux
2026-02-17 11:18:37 +01:00
parent 61bdee3e61
commit c1f41caa8d
+10 -10
View File
@@ -135,7 +135,7 @@ int main(int n, char **v)
int input_is_float = 0; int input_is_float = 0;
int no_fft = 0; int no_fft = 0;
int delay = 0; int delay = 0;
int skip = 0; uint64_t skip = 0;
int symbols_per_subframe; int symbols_per_subframe;
long sampling_rate = 61440000; long sampling_rate = 61440000;
int mu = 1; int mu = 1;
@@ -152,7 +152,7 @@ int main(int n, char **v)
if (!strcmp(v[i], "-srate")) { if (i>n-2) usage(); sampling_rate = atol(v[++i]); continue; } if (!strcmp(v[i], "-srate")) { if (i>n-2) usage(); sampling_rate = atol(v[++i]); continue; }
if (!strcmp(v[i], "-prb")) { if (i>n-2) usage(); prb = atoi(v[++i]); continue; } if (!strcmp(v[i], "-prb")) { if (i>n-2) usage(); prb = atoi(v[++i]); continue; }
if (!strcmp(v[i], "-mu")) { if (i>n-2) usage(); mu = atoi(v[++i]); continue; } if (!strcmp(v[i], "-mu")) { if (i>n-2) usage(); mu = atoi(v[++i]); continue; }
if (!strcmp(v[i], "-skip")) { if (i>n-2) usage(); skip = atoi(v[++i]); continue; } if (!strcmp(v[i], "-skip")) { if (i>n-2) usage(); skip = atoll(v[++i]); continue; }
usage(); usage();
} }
@@ -222,14 +222,14 @@ int main(int n, char **v)
int back_color = 0; int back_color = 0;
int hpixel = 0; int hpixel = 0;
if (skip) { /* skip data */
if (input_is_float) { int sample_size = input_is_float ? 8 : 4;
float intime[skip * 2]; uint64_t to_skip = skip;
if (fread(intime, skip * 8, 1, stdin) != 1) abort(); while (to_skip) {
} else { char intime[4096 * sample_size];
short intime[skip * 2]; int count = to_skip > 4096 ? 4096 : to_skip;
if (fread(intime, skip * 4, 1, stdin) != 1) abort(); if (fread(intime, count * sample_size, 1, stdin) != 1) abort();
} to_skip -= count;
} }
while (1) { while (1) {