From 513664a0e34a0ef6329802ce2351418c828c5b69 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Sat, 16 Dec 2023 08:30:47 +0100 Subject: [PATCH] shuffle the code bits --- decode.cc | 3 +++ encode.cc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/decode.cc b/decode.cc index 9de7d57..b8d7ed6 100644 --- a/decode.cc +++ b/decode.cc @@ -14,6 +14,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" @@ -204,6 +205,7 @@ struct Decoder CODE::OrderedStatisticsDecoder<255, 71, 4> osddec; CODE::PolarEncoder polarenc; CODE::PolarListDecoder polardec; + CODE::ReverseFisherYatesShuffle shuffle; int8_t genmat[255*71]; mesg_type mesg[max_bits], mess[code_len]; code_type code[code_len]; @@ -431,6 +433,7 @@ struct Decoder *len = data_bits / 8; crc_bits = data_bits + 32; 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 4ddc6e9..919cc60 100644 --- a/encode.cc +++ b/encode.cc @@ -9,6 +9,7 @@ Copyright 2021 Ahmet Inan #include #include "xorshift.hh" #include "complex.hh" +#include "permute.hh" #include "utils.hh" #include "bitman.hh" #include "decibel.hh" @@ -48,6 +49,7 @@ struct Encoder CODE::CRC crc1; CODE::BoseChaudhuriHocquenghemEncoder<255, 71> bchenc; CODE::PolarSysEnc polarenc; + CODE::FisherYatesShuffle shuffle; code_type code[code_len], mesg[max_bits]; cmplx fdom[symbol_len]; cmplx tdom[symbol_len]; @@ -241,6 +243,7 @@ struct Encoder for (int i = 0; i < 32; ++i) mesg[i+data_bits] = nrz((crc1()>>i)&1); polarenc(code, mesg, frozen_bits, code_order); + shuffle(code); for (int i = 0; i < cons_cols; ++i) prev[i] = fdom[bin(i+code_off)]; for (int j = 0; j < cons_rows; ++j) {