mirror of
https://github.com/aicodix/modem.git
synced 2026-04-27 14:30:34 +00:00
minor cleanup
This commit is contained in:
parent
b8dd4de3d8
commit
16b5f7e5c9
3 changed files with 10 additions and 10 deletions
|
|
@ -33,7 +33,7 @@ struct Common
|
|||
CODE::CRC<uint16_t> crc0;
|
||||
CODE::CRC<uint32_t> crc1;
|
||||
CODE::HadamardEncoder<7> hadamard_encoder;
|
||||
int8_t side[64];
|
||||
int8_t side[side_tones];
|
||||
uint8_t data[data_max];
|
||||
const uint32_t *frozen_bits;
|
||||
int mod_bits;
|
||||
|
|
|
|||
15
decode.cc
15
decode.cc
|
|
@ -295,20 +295,19 @@ struct Decoder : Common
|
|||
}
|
||||
for (int i = 0; i < tone_count; ++i)
|
||||
tone[i] = fdom[bin(i+tone_off)];
|
||||
for (int i = 0; i < tone_count; ++i)
|
||||
if (i % block_length == side_off)
|
||||
tone[i] *= nrz(seq1());
|
||||
for (int i = side_off; i < tone_count; i += block_length)
|
||||
tone[i] *= nrz(seq1());
|
||||
for (int i = 0; i < tone_count; ++i)
|
||||
demod[i] = demod_or_erase(tone[i], chan[i]);
|
||||
for (int i = 0; i < side_tones; ++i)
|
||||
side[i] = clamp(std::nearbyint(127 * demod[i*block_length+side_off].real()));
|
||||
int side_data = hadamard_decoder(side);
|
||||
if (side_data < 0) {
|
||||
std::cerr << "side data damaged" << std::endl;
|
||||
int side_info = hadamard_decoder(side);
|
||||
if (side_info < 0) {
|
||||
std::cerr << "side info damaged" << std::endl;
|
||||
oper_mode = -1;
|
||||
break;
|
||||
}
|
||||
hadamard_encoder(side, side_data);
|
||||
hadamard_encoder(side, side_info);
|
||||
for (int i = 0; i < side_tones; ++i) {
|
||||
tone[block_length*i+side_off] *= side[i];
|
||||
demod[block_length*i+side_off] *= side[i];
|
||||
|
|
@ -325,7 +324,7 @@ struct Decoder : Common
|
|||
for (int i = 0; i < tone_count; ++i)
|
||||
chan[i] *= DSP::polar<value>(1, tse(i+tone_off));
|
||||
CODE::XorShiftMask<int, 14, 1, 5, 10, 50> combination;
|
||||
int trial = side_data;
|
||||
int trial = side_info;
|
||||
int comb = 0;
|
||||
for (int i = 0; i <= trial; ++i)
|
||||
comb = combination();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ Copyright 2021 Ahmet Inan <inan@aicodix.de>
|
|||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include "common.hh"
|
||||
|
|
@ -34,7 +35,7 @@ struct Encoder : public Common
|
|||
DSP::FastFourierTransform<symbol_len, cmplx, -1> fwd;
|
||||
DSP::FastFourierTransform<symbol_len, cmplx, 1> bwd;
|
||||
CODE::PolarEncoder<code_type> polar_encoder;
|
||||
code_type code[bits_max], perm[bits_max], mesg[bits_max], meta[256];
|
||||
code_type code[bits_max], perm[bits_max], mesg[bits_max], meta[data_tones];
|
||||
cmplx fdom[symbol_len];
|
||||
cmplx tdom[symbol_len];
|
||||
cmplx best[symbol_len];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue