mirror of
https://github.com/aicodix/modem.git
synced 2026-04-27 14:30:34 +00:00
send meta data with each symbol
This commit is contained in:
parent
d73195d6a8
commit
b9d060ad22
3 changed files with 17 additions and 14 deletions
|
|
@ -29,7 +29,7 @@ struct Common
|
|||
static const int first_reserved = 9;
|
||||
CODE::CRC<uint32_t> crc0;
|
||||
CODE::HadamardEncoder<6> hadamard_encoder;
|
||||
int8_t mode[32];
|
||||
int8_t meta[32];
|
||||
uint8_t data[data_max];
|
||||
const uint32_t *frozen_bits;
|
||||
int mod_bits;
|
||||
|
|
|
|||
19
decode.cc
19
decode.cc
|
|
@ -233,8 +233,8 @@ struct Decoder : Common
|
|||
CODE::MLS seq1(mls1_poly);
|
||||
auto clamp = [](int v){ return v < -127 ? -127 : v > 127 ? 127 : v; };
|
||||
for (int i = 0; i < pilot_tones; ++i)
|
||||
mode[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(mode);
|
||||
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;
|
||||
continue;
|
||||
|
|
@ -264,17 +264,22 @@ struct Decoder : Common
|
|||
} else {
|
||||
for (int i = 0; i < symbol_pos+symbol_len+extended_len; ++i)
|
||||
correlator(buf = next_sample());
|
||||
hadamard_encoder(mode, oper_mode);
|
||||
for (int i = 0; i < tone_count; ++i)
|
||||
tone[i] = fdom[bin(i+tone_off)];
|
||||
for (int i = 0; i < pilot_tones; ++i)
|
||||
tone[block_length*i+pilot_off] *= mode[i];
|
||||
seq1.reset();
|
||||
}
|
||||
for (int i = 0; i < tone_count; ++i)
|
||||
tone[i] = fdom[bin(i+tone_off)];
|
||||
for (int i = 0; i < pilot_tones; ++i)
|
||||
tone[block_length*i+pilot_off] *= nrz(seq1());
|
||||
for (int i = 0; i < tone_count; ++i)
|
||||
demod[i] = demod_or_erase(tone[i], chan[i]);
|
||||
for (int i = 0; i < pilot_tones; ++i)
|
||||
meta[i] = clamp(std::nearbyint(127 * demod[i*block_length+pilot_off].real()));
|
||||
int meta_data = hadamard_decoder(meta);
|
||||
hadamard_encoder(meta, meta_data);
|
||||
for (int i = 0; i < pilot_tones; ++i) {
|
||||
tone[block_length*i+pilot_off] *= meta[i];
|
||||
demod[block_length*i+pilot_off] *= meta[i];
|
||||
}
|
||||
for (int i = 0; i < pilot_tones; ++i) {
|
||||
index[i] = tone_off + block_length * i + pilot_off;
|
||||
phase[i] = arg(demod[block_length*i+pilot_off]);
|
||||
|
|
|
|||
10
encode.cc
10
encode.cc
|
|
@ -251,7 +251,6 @@ struct Encoder : public Common
|
|||
guard_interval_weights();
|
||||
papr_min = 1000, papr_max = -1000;
|
||||
leading_noise();
|
||||
hadamard_encoder(mode, oper_mode);
|
||||
for (int input_index = 0; input_index < input_count; ++input_index) {
|
||||
const char *input_name = input_names[input_index];
|
||||
if (input_count == 1 && input_name[0] == '-' && input_name[1] == 0)
|
||||
|
|
@ -277,14 +276,13 @@ struct Encoder : public Common
|
|||
polar_encoder(code, mesg, frozen_bits, code_order);
|
||||
shuffle(perm, code);
|
||||
CODE::MLS seq1(mls1_poly);
|
||||
for (int j = 0, k = 0, m = 0; j < symbol_count; ++j) {
|
||||
for (int j = 0, k = 0; j < symbol_count; ++j) {
|
||||
pilot_off = (block_skew * j + first_pilot) % block_length;
|
||||
reserved_off = (block_skew * j + first_reserved) % block_length;
|
||||
for (int i = 0; i < tone_count; ++i) {
|
||||
hadamard_encoder(meta, j ? j : oper_mode);
|
||||
for (int i = 0, m = 0; i < tone_count; ++i) {
|
||||
if (i % block_length == pilot_off) {
|
||||
tone[i] = nrz(seq1());
|
||||
if (j == 0)
|
||||
tone[i] *= mode[m++];
|
||||
tone[i] = nrz(seq1()) * meta[m++];
|
||||
} else if (i % block_length == reserved_off) {
|
||||
tone[i] = 0;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue