From 4b12986dc0487c7d6f96c917e1d18819ad2037e7 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Sun, 13 Jul 2025 08:40:51 +0200 Subject: [PATCH] now we can try more combinations on first symbol --- decode.cc | 10 +++++----- encode.cc | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/decode.cc b/decode.cc index b2de035..9b2168d 100644 --- a/decode.cc +++ b/decode.cc @@ -232,12 +232,12 @@ struct Decoder : Common meta[i] = clamp(std::nearbyint(127 * demod_or_erase(fdom[bin(i*block_length+first_meta+tone_off)], chan[i*block_length+first_meta]).real() * nrz(seq1()))); seq1(); } - int mode = hadamard_decoder(meta); - if (mode < 0 || mode > 7) { - std::cerr << "operation mode " << mode << " unsupported." << std::endl; + int meta_data = hadamard_decoder(meta); + if (meta_data < 0) { + std::cerr << "meta data damaged" << std::endl; continue; } - setup(mode); + setup(meta_data >> 3); std::cerr << "oper mode: " << oper_mode << std::endl; if (oper_mode >= 3) { for (int i = 0; i < tone_count; ++i) @@ -319,7 +319,7 @@ struct Decoder : Common chan[i] = DSP::lerp(chan[i], tone[i], value(0.5)); } CODE::XorShiftMask combination; - int trial = j ? (meta_data << 6) | seed_data : seed_data; + int trial = j ? (meta_data << 6) | seed_data : (meta_data & 7) << 6 | seed_data; int comb = 0; for (int i = 0; i <= trial; ++i) comb = combination(); diff --git a/encode.cc b/encode.cc index e99bd7b..aa4da26 100644 --- a/encode.cc +++ b/encode.cc @@ -80,14 +80,14 @@ struct Encoder : public Common for (int i = 0; differential && symbol_number > 0 && i < tone_count; ++i) tone[i] *= prev[i]; value best_papr = 1000; - int trials = symbol_number ? 4096 : 64; + int trials = symbol_number ? 4096 : 512; CODE::XorShiftMask combination; for (int trial = 0; trial < trials; ++trial) { for (int i = 0; i < tone_count; ++i) temp[i] = tone[i]; if (symbol_number >= 0) { int comb = combination(); - int meta_data = symbol_number ? trial >> 6 : oper_mode; + int meta_data = symbol_number ? trial >> 6 : (oper_mode << 3) | (trial >> 6); hadamard_encoder(meta, meta_data); int seed_data = trial & 63; hadamard_encoder(seed, seed_data);