made current operation mode accessible

This commit is contained in:
Ahmet Inan 2025-07-10 08:04:57 +02:00
commit ec4e5b66a4
2 changed files with 8 additions and 5 deletions

View file

@ -36,6 +36,7 @@ struct Common
int data_bits;
int data_bytes;
int code_order;
int oper_mode;
int tone_off;
int pilot_off;
int reserved_off;
@ -44,9 +45,9 @@ struct Common
Common() : crc0(0x8F6E37A0) {}
void setup(int oper_mode)
void setup(int mode)
{
switch (oper_mode) {
switch (mode) {
case 0:
mod_bits = 1;
symbol_count = 8;
@ -274,6 +275,7 @@ struct Common
default:
return;
}
oper_mode = mode;
data_bytes = data_bits / 8;
}
};

View file

@ -234,11 +234,12 @@ struct Decoder : Common
auto clamp = [](int v){ return v < -127 ? -127 : v > 127 ? 127 : v; };
for (int i = 0; i < pilot_tones; ++i)
meta[i] = clamp(std::nearbyint(127 * demod_or_erase(fdom[bin(i*block_length+first_pilot+tone_off)], chan[i*block_length+first_pilot]).real() * nrz(seq1())));
int oper_mode = hadamard_decoder(meta);
if (oper_mode < 0 || oper_mode > 27) {
std::cerr << "operation mode " << oper_mode << " unsupported." << std::endl;
int mode = hadamard_decoder(meta);
if (mode < 0 || mode > 27) {
std::cerr << "operation mode " << mode << " unsupported." << std::endl;
continue;
}
oper_mode = mode;
std::cerr << "oper mode: " << oper_mode << std::endl;
if (oper_mode >= 10) {
for (int i = 0; i < tone_count; ++i)