From 5afd9fa8d6b5dccbaebaba61ab01e20ad8d52de4 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Thu, 11 May 2023 09:07:02 +0200 Subject: [PATCH] shuffle bits to improve decoding with burst errors --- decode.cc | 3 +++ encode.cc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/decode.cc b/decode.cc index 1b1efbf..c0e26f6 100644 --- a/decode.cc +++ b/decode.cc @@ -13,6 +13,7 @@ namespace DSP { using std::abs; using std::min; using std::cos; using std::sin; #include "xorshift.hh" #include "trigger.hh" #include "complex.hh" +#include "permute.hh" #include "decibel.hh" #include "blockdc.hh" #include "hilbert.hh" @@ -192,6 +193,7 @@ struct Decoder CODE::HadamardDecoder<8> hadamard; CODE::PolarEncoder polarenc; CODE::PolarListDecoder polardec; + CODE::ReverseFisherYatesShuffle shuffle; mesg_type mesg[mesg_bits], mess[code_len]; code_type code[code_len]; cmplx cons[cons_total], prev[subcarrier_count]; @@ -352,6 +354,7 @@ struct Decoder mod_soft(code+mod_bits*i, cons[i], precision); } CODE::PolarHelper::PATH metric[mesg_type::SIZE]; + shuffle(code); polardec(metric, mesg, code, frozen_bits, code_order); systematic(); int order[mesg_type::SIZE]; diff --git a/encode.cc b/encode.cc index 1c6cff2..04d0ffb 100644 --- a/encode.cc +++ b/encode.cc @@ -9,6 +9,7 @@ Copyright 2023 Ahmet Inan #include #include "xorshift.hh" #include "complex.hh" +#include "permute.hh" #include "phasor.hh" #include "bitman.hh" #include "utils.hh" @@ -44,6 +45,7 @@ struct Encoder CODE::CRC crc; CODE::HadamardEncoder<8> hadamard; CODE::PolarSysEnc polarenc; + CODE::FisherYatesShuffle shuffle; code_type code[code_len], mesg[mesg_bits]; cmplx fdom[symbol_len], tdom[symbol_len], guard[guard_len]; @@ -118,6 +120,7 @@ struct Encoder for (int i = 0; i < 32; ++i) mesg[i+data_bits] = nrz((crc()>>i)&1); polarenc(code, mesg, frozen_4096_2080, code_order); + shuffle(code); for (int j = 0; j < payload_symbols; ++j) { for (int i = 0; i < subcarrier_count; ++i) fdom[first_subcarrier+i] *=