added six new modes

Mode 23: DQPSK, 1/2-rate code, 1600 Hz bandwidth and 1.08 seconds
Mode 24: DQPSK, 3/4-rate code, 1600 Hz bandwidth and 1.08 seconds
Mode 25: QAM16, 1/2-rate code, 1700 Hz bandwidth and 1.08 seconds
Mode 26: QAM16, 3/4-rate code, 1700 Hz bandwidth and 1.08 seconds
Mode 27: QAM64, 2/3-rate code, 1900 Hz bandwidth and 1.26 seconds
Mode 28: QAM64, 3/4-rate code, 1900 Hz bandwidth and 1.26 seconds
This commit is contained in:
Ahmet Inan 2023-12-25 03:39:59 +01:00
commit fff6c60bbe
4 changed files with 348 additions and 138 deletions

249
decode.cc
View file

@ -173,22 +173,15 @@ struct Decoder
typedef SIMD<code_type, 16 / sizeof(code_type)> mesg_type;
#endif
typedef DSP::Const<value> Const;
static const int code_order = 12;
static const int mod_bits = 4;
static const int code_len = 1 << code_order;
static const int symbol_len = (1280 * rate) / 8000;
static const int filter_len = (((21 * rate) / 8000) & ~3) | 1;
static const int guard_len = symbol_len / 8;
static const int extended_len = symbol_len + guard_len;
static const int max_bits = 2720 + 32;
static const int comb_cols = 8;
static const int code_cols = 256;
static const int cons_cols = code_cols + comb_cols;
static const int comb_dist = cons_cols / comb_cols;
static const int comb_off = comb_dist / 2;
static const int cons_rows = 4;
static const int cons_total = cons_rows * cons_cols;
static const int code_off = - cons_cols / 2;
static const int code_max = 13;
static const int bits_max = 1 << code_max;
static const int cols_max = 273 + 16;
static const int rows_max = 5;
static const int cons_max = cols_max * rows_max;
static const int mls0_len = 127;
static const int mls0_off = - mls0_len + 1;
static const int mls0_poly = 0b10001001;
@ -202,22 +195,26 @@ struct Decoder
DSP::BlockDC<value, value> blockdc;
DSP::Hilbert<cmplx, filter_len> hilbert;
DSP::BipBuffer<cmplx, buffer_len> input_hist;
DSP::TheilSenEstimator<value, cons_cols> tse;
DSP::TheilSenEstimator<value, cols_max> tse;
SchmidlCox<value, cmplx, search_pos, symbol_len/2, guard_len> correlator;
CODE::CRC<uint16_t> crc0;
CODE::CRC<uint32_t> crc1;
CODE::OrderedStatisticsDecoder<255, 71, 4> osddec;
CODE::PolarEncoder<mesg_type> polarenc;
CODE::PolarListDecoder<mesg_type, code_order> polardec;
CODE::ReverseFisherYatesShuffle<code_len> shuffle;
CODE::PolarListDecoder<mesg_type, code_max> polardec;
CODE::ReverseFisherYatesShuffle<2048> shuffle_2048;
CODE::ReverseFisherYatesShuffle<4096> shuffle_4096;
CODE::ReverseFisherYatesShuffle<8192> shuffle_8192;
int8_t genmat[255*71];
mesg_type mesg[max_bits], mess[code_len];
code_type code[code_len];
cmplx cons[cons_total], prev[cons_cols];
mesg_type mesg[bits_max], mess[bits_max];
code_type code[bits_max];
cmplx cons[cons_max], prev[cols_max];
cmplx fdom[symbol_len], tdom[symbol_len];
value index[cons_cols], phase[cons_cols];
value index[cols_max], phase[cols_max];
value cfo_rad, sfo_rad;
const uint32_t *frozen_bits;
int mod_bits;
int code_order;
int symbol_pos;
int oper_mode;
int crc_bits;
@ -258,15 +255,51 @@ struct Decoder
}
cmplx mod_map(code_type *b)
{
return QuadratureAmplitudeModulation<1 << mod_bits, cmplx, code_type>::map(b);
switch (mod_bits) {
case 2:
return PhaseShiftKeying<4, cmplx, code_type>::map(b);
case 4:
return QuadratureAmplitudeModulation<16, cmplx, code_type>::map(b);
case 6:
return QuadratureAmplitudeModulation<64, cmplx, code_type>::map(b);
}
return 0;
}
void mod_hard(code_type *b, cmplx c)
{
QuadratureAmplitudeModulation<1 << mod_bits, cmplx, code_type>::hard(b, c);
switch (mod_bits) {
case 2:
return PhaseShiftKeying<4, cmplx, code_type>::hard(b, c);
case 4:
return QuadratureAmplitudeModulation<16, cmplx, code_type>::hard(b, c);
case 6:
return QuadratureAmplitudeModulation<64, cmplx, code_type>::hard(b, c);
}
}
void mod_soft(code_type *b, cmplx c, value precision)
{
QuadratureAmplitudeModulation<1 << mod_bits, cmplx, code_type>::soft(b, c, precision);
switch (mod_bits) {
case 2:
return PhaseShiftKeying<4, cmplx, code_type>::soft(b, c, precision);
case 4:
return QuadratureAmplitudeModulation<16, cmplx, code_type>::soft(b, c, precision);
case 6:
return QuadratureAmplitudeModulation<64, cmplx, code_type>::soft(b, c, precision);
}
}
void shuffle(code_type *c)
{
switch (code_order) {
case 11:
shuffle_2048(c);
break;
case 12:
shuffle_4096(c);
break;
case 13:
shuffle_8192(c);
break;
}
}
const cmplx *next_sample()
{
@ -335,7 +368,7 @@ struct Decoder
continue;
}
oper_mode = md & 255;
if (oper_mode && (oper_mode < 17 || oper_mode > 19)) {
if (oper_mode && (oper_mode < 23 || oper_mode > 28)) {
std::cerr << "operation mode " << oper_mode << " unsupported." << std::endl;
continue;
}
@ -355,6 +388,73 @@ struct Decoder
if (!okay || !oper_mode)
return;
int data_bits = 0;
int cons_rows = 0;
int comb_cols = 0;
int code_cols = 0;
switch (oper_mode) {
case 23:
mod_bits = 2;
cons_rows = 4;
comb_cols = 0;
code_order = 11;
code_cols = 256;
data_bits = 1024;
frozen_bits = frozen_2048_1056;
break;
case 24:
mod_bits = 2;
cons_rows = 4;
comb_cols = 0;
code_order = 11;
code_cols = 256;
data_bits = 1536;
frozen_bits = frozen_2048_1568;
break;
case 25:
mod_bits = 4;
cons_rows = 4;
comb_cols = 8;
code_order = 12;
code_cols = 256;
data_bits = 2048;
frozen_bits = frozen_4096_2080;
break;
case 26:
mod_bits = 4;
cons_rows = 4;
comb_cols = 8;
code_order = 12;
code_cols = 256;
data_bits = 3072;
frozen_bits = frozen_4096_3104;
break;
case 27:
mod_bits = 6;
cons_rows = 5;
comb_cols = 16;
code_order = 13;
code_cols = 273;
data_bits = 5440;
frozen_bits = frozen_8192_5472;
break;
case 28:
mod_bits = 6;
cons_rows = 5;
comb_cols = 16;
code_order = 13;
code_cols = 273;
data_bits = 6144;
frozen_bits = frozen_8192_6176;
break;
default:
return;
}
int cons_cols = code_cols + comb_cols;
int comb_dist = comb_cols ? cons_cols / comb_cols : 1;
int comb_off = comb_cols ? comb_dist / 2 : 1;
int code_off = - cons_cols / 2;
for (int i = 0; i < symbol_pos+extended_len; ++i)
buf = next_sample();
for (int i = 0; i < symbol_len; ++i)
@ -376,30 +476,32 @@ struct Decoder
fwd(fdom, tdom);
for (int i = 0; i < cons_cols; ++i)
cons[cons_cols*j+i] = demod_or_erase(fdom[bin(i+code_off)], prev[i]);
for (int i = 0; i < comb_cols; ++i)
cons[cons_cols*j+comb_dist*i+comb_off] *= nrz(seq0());
for (int i = 0; i < comb_cols; ++i) {
index[i] = code_off + comb_dist * i + comb_off;
phase[i] = arg(cons[cons_cols*j+comb_dist*i+comb_off]);
}
tse.compute(index, phase, comb_cols);
//std::cerr << "Theil-Sen slope = " << tse.slope() << std::endl;
//std::cerr << "Theil-Sen yint = " << tse.yint() << std::endl;
for (int i = 0; i < cons_cols; ++i)
cons[cons_cols*j+i] *= DSP::polar<value>(1, -tse(i+code_off));
for (int i = 0; i < cons_cols; ++i)
if (i % comb_dist == comb_off)
prev[i] = fdom[bin(i+code_off)];
else
prev[i] *= DSP::polar<value>(1, tse(i+code_off));
for (int i = 0; i < cons_cols; ++i) {
index[i] = code_off + i;
if (i % comb_dist == comb_off) {
phase[i] = arg(cons[cons_cols*j+i]);
} else {
code_type tmp[mod_bits];
mod_hard(tmp, cons[cons_cols*j+i]);
phase[i] = arg(cons[cons_cols*j+i] * conj(mod_map(tmp)));
if (oper_mode > 24) {
for (int i = 0; i < comb_cols; ++i)
cons[cons_cols*j+comb_dist*i+comb_off] *= nrz(seq0());
for (int i = 0; i < comb_cols; ++i) {
index[i] = code_off + comb_dist * i + comb_off;
phase[i] = arg(cons[cons_cols*j+comb_dist*i+comb_off]);
}
tse.compute(index, phase, comb_cols);
//std::cerr << "Theil-Sen slope = " << tse.slope() << std::endl;
//std::cerr << "Theil-Sen yint = " << tse.yint() << std::endl;
for (int i = 0; i < cons_cols; ++i)
cons[cons_cols*j+i] *= DSP::polar<value>(1, -tse(i+code_off));
for (int i = 0; i < cons_cols; ++i)
if (i % comb_dist == comb_off)
prev[i] = fdom[bin(i+code_off)];
else
prev[i] *= DSP::polar<value>(1, tse(i+code_off));
for (int i = 0; i < cons_cols; ++i) {
index[i] = code_off + i;
if (i % comb_dist == comb_off) {
phase[i] = arg(cons[cons_cols*j+i]);
} else {
code_type tmp[mod_bits];
mod_hard(tmp, cons[cons_cols*j+i]);
phase[i] = arg(cons[cons_cols*j+i] * conj(mod_map(tmp)));
}
}
}
tse.compute(index, phase, cons_cols);
@ -407,50 +509,49 @@ struct Decoder
//std::cerr << "Theil-Sen yint = " << tse.yint() << std::endl;
for (int i = 0; i < cons_cols; ++i)
cons[cons_cols*j+i] *= DSP::polar<value>(1, -tse(i+code_off));
for (int i = 0; i < cons_cols; ++i)
if (i % comb_dist != comb_off)
prev[i] *= DSP::polar<value>(1, tse(i+code_off));
if (oper_mode > 24) {
for (int i = 0; i < cons_cols; ++i)
if (i % comb_dist != comb_off)
prev[i] *= DSP::polar<value>(1, tse(i+code_off));
} else {
for (int i = 0; i < cons_cols; ++i)
prev[i] = fdom[bin(i+code_off)];
}
std::cerr << ".";
}
std::cerr << " done" << std::endl;
std::cerr << "Es/N0 (dB):";
value sp = 0, np = 0;
for (int j = 0, k = 0; j < cons_rows; ++j) {
for (int i = 0; i < comb_cols; ++i) {
cmplx hard(1, 0);
cmplx error = cons[cons_cols*j+comb_dist*i+comb_off] - hard;
sp += norm(hard);
np += norm(error);
if (oper_mode > 24) {
for (int i = 0; i < comb_cols; ++i) {
cmplx hard(1, 0);
cmplx error = cons[cons_cols*j+comb_dist*i+comb_off] - hard;
sp += norm(hard);
np += norm(error);
}
} else {
for (int i = 0; i < cons_cols; ++i) {
code_type tmp[mod_bits];
mod_hard(tmp, cons[cons_cols*j+i]);
cmplx hard = mod_map(tmp);
cmplx error = cons[cons_cols*j+i] - hard;
sp += norm(hard);
np += norm(error);
}
}
value precision = sp / np;
// precision = 8;
value snr = DSP::decibel(precision);
std::cerr << " " << snr;
for (int i = 0; i < cons_cols; ++i) {
if (i % comb_dist == comb_off)
if (oper_mode > 24 && i % comb_dist == comb_off)
continue;
mod_soft(code+k, cons[cons_cols*j+i], precision);
k += mod_bits;
}
}
std::cerr << std::endl;
int data_bits = 0;
switch (oper_mode) {
case 17:
data_bits = 2720;
frozen_bits = frozen_4096_2752;
break;
case 18:
data_bits = 2048;
frozen_bits = frozen_4096_2080;
break;
case 19:
data_bits = 1360;
frozen_bits = frozen_4096_1392;
break;
default:
return;
}
*len = data_bits / 8;
crc_bits = data_bits + 32;
CODE::PolarHelper<mesg_type>::PATH metric[mesg_type::SIZE];
@ -517,7 +618,7 @@ int main(int argc, char **argv)
if (argc > 3)
skip_count = std::atoi(argv[3]);
const int data_max = 340;
const int data_max = 768;
uint8_t *output_data = new uint8_t[data_max];
int data_len = 0;

223
encode.cc
View file

@ -29,18 +29,10 @@ template <typename value, typename cmplx, int rate>
struct Encoder
{
typedef int8_t code_type;
static const int mod_bits = 4;
static const int code_order = 12;
static const int code_len = 1 << code_order;
static const int symbol_len = (1280 * rate) / 8000;
static const int guard_len = symbol_len / 8;
static const int max_bits = 2720 + 32;
static const int comb_cols = 8;
static const int code_cols = 256;
static const int cons_cols = code_cols + comb_cols;
static const int comb_dist = cons_cols / comb_cols;
static const int comb_off = comb_dist / 2;
static const int cons_rows = 4;
static const int bits_max = 8192;
static const int cols_max = 273 + 16;
static const int mls0_len = 127;
static const int mls0_poly = 0b10001001;
static const int mls1_len = 255;
@ -53,16 +45,23 @@ struct Encoder
CODE::CRC<uint32_t> crc1;
CODE::BoseChaudhuriHocquenghemEncoder<255, 71> bchenc;
CODE::PolarSysEnc<code_type> polarenc;
CODE::FisherYatesShuffle<code_len> shuffle;
code_type code[code_len], mesg[max_bits];
CODE::FisherYatesShuffle<2048> shuffle_2048;
CODE::FisherYatesShuffle<4096> shuffle_4096;
CODE::FisherYatesShuffle<8192> shuffle_8192;
code_type code[bits_max], mesg[bits_max];
cmplx fdom[symbol_len];
cmplx tdom[symbol_len];
cmplx temp[symbol_len];
cmplx kern[symbol_len];
cmplx guard[guard_len];
cmplx prev[cons_cols];
cmplx prev[cols_max];
value papr_min, papr_max;
int mod_bits;
int oper_mode;
int code_order;
int code_off;
int cons_cols;
int cons_rows;
int mls0_off;
int mls1_off;
@ -117,8 +116,8 @@ struct Encoder
bwd(tdom, fdom);
for (int i = 0; i < symbol_len; ++i)
tdom[i] /= std::sqrt(value(symbol_len*4));
clipping_and_filtering(papr_reduction);
if (papr_reduction)
clipping_and_filtering(oper_mode > 24 && papr_reduction);
if (oper_mode > 24 && papr_reduction)
tone_reservation();
for (int i = 0; i < symbol_len; ++i)
tdom[i] = cmplx(std::min(value(1), tdom[i].real()), std::min(value(1), tdom[i].imag()));
@ -192,58 +191,148 @@ struct Encoder
fdom[bin(i+mls1_off)] *= fdom[bin(i-1+mls1_off)];
for (int i = 0; i < mls1_len; ++i)
fdom[bin(i+mls1_off)] *= nrz(seq1());
for (int i = 0; i < comb_cols / 2; ++i) {
fdom[bin(i+code_off)] = cons_fac * nrz(seq1());
fdom[bin(i+mls1_off+mls1_len)] = cons_fac * nrz(seq1());
if (oper_mode > 24) {
for (int i = code_off; i < code_off + cons_cols; ++i) {
if (i == mls1_off-1)
i += mls1_len + 1;
fdom[bin(i)] = cons_fac * nrz(seq1());
}
}
symbol();
}
cmplx mod_map(code_type *b)
{
return QuadratureAmplitudeModulation<1 << mod_bits, cmplx, code_type>::map(b);
switch (mod_bits) {
case 2:
return PhaseShiftKeying<4, cmplx, code_type>::map(b);
case 4:
return QuadratureAmplitudeModulation<16, cmplx, code_type>::map(b);
case 6:
return QuadratureAmplitudeModulation<64, cmplx, code_type>::map(b);
}
return 0;
}
Encoder(DSP::WritePCM<value> *pcm, const uint8_t *inp, int freq_off, uint64_t call_sign, int oper_mode, int reserved_tones) :
void shuffle(code_type *c)
{
switch (code_order) {
case 11:
shuffle_2048(c);
break;
case 12:
shuffle_4096(c);
break;
case 13:
shuffle_8192(c);
break;
}
}
Encoder(DSP::WritePCM<value> *pcm, const uint8_t *inp, int freq_off, uint64_t call_sign, int oper_mode) :
pcm(pcm), crc0(0xA8F4), crc1(0x8F6E37A0), bchenc({
0b100011101, 0b101110111, 0b111110011, 0b101101001,
0b110111101, 0b111100111, 0b100101011, 0b111010111,
0b000010011, 0b101100101, 0b110001011, 0b101100011,
0b100011011, 0b100111111, 0b110001101, 0b100101101,
0b101011111, 0b111111001, 0b111000011, 0b100111001,
0b110101001, 0b000011111, 0b110000111, 0b110110001})
0b110101001, 0b000011111, 0b110000111, 0b110110001}),
oper_mode(oper_mode)
{
const uint32_t *frozen_bits = nullptr;
int code_cols = 0;
int comb_cols = 0;
int comb_dist = 1;
int comb_off = 1;
int data_bits = 0;
int reserved_tones = 0;
switch (oper_mode) {
case 0:
cons_cols = 256;
break;
case 23:
mod_bits = 2;
cons_rows = 4;
comb_cols = 0;
code_order = 11;
code_cols = 256;
data_bits = 1024;
reserved_tones = 0;
frozen_bits = frozen_2048_1056;
break;
case 24:
mod_bits = 2;
cons_rows = 4;
comb_cols = 0;
code_order = 11;
code_cols = 256;
data_bits = 1536;
reserved_tones = 0;
frozen_bits = frozen_2048_1568;
break;
case 25:
mod_bits = 4;
cons_rows = 4;
comb_cols = 8;
code_order = 12;
code_cols = 256;
data_bits = 2048;
reserved_tones = 8;
frozen_bits = frozen_4096_2080;
break;
case 26:
mod_bits = 4;
cons_rows = 4;
comb_cols = 8;
code_order = 12;
code_cols = 256;
data_bits = 3072;
reserved_tones = 8;
frozen_bits = frozen_4096_3104;
break;
case 27:
mod_bits = 6;
cons_rows = 5;
comb_cols = 16;
code_order = 13;
code_cols = 273;
data_bits = 5440;
reserved_tones = 15;
frozen_bits = frozen_8192_5472;
break;
case 28:
mod_bits = 6;
cons_rows = 5;
comb_cols = 16;
code_order = 13;
code_cols = 273;
data_bits = 6144;
reserved_tones = 15;
frozen_bits = frozen_8192_6176;
break;
default:
return;
}
int offset = (freq_off * symbol_len) / rate;
code_off = offset - cons_cols / 2;
mls0_off = offset - mls0_len + 1;
mls1_off = offset - mls1_len / 2;
value kern_fac = 1 / value(10 * reserved_tones);
for (int i = 0; i < reserved_tones / 2; ++i) {
fdom[bin(code_off-1-i)] = kern_fac;
fdom[bin(code_off+cons_cols+i)] = kern_fac;
if (oper_mode > 0) {
cons_cols = code_cols + comb_cols;
comb_dist = comb_cols ? cons_cols / comb_cols : 1;
comb_off = comb_cols ? comb_dist / 2 : 1;
code_off = offset - cons_cols / 2;
if (reserved_tones) {
value kern_fac = 1 / value(10 * reserved_tones);
for (int i = 0, j = code_off - reserved_tones / 2; i < reserved_tones; ++i, ++j) {
if (j == code_off)
j += cons_cols;
fdom[bin(j)] = kern_fac;
}
bwd(kern, fdom);
}
}
bwd(kern, fdom);
papr_min = 1000, papr_max = -1000;
pilot_block();
schmidl_cox();
meta_data((call_sign << 8) | oper_mode);
if (oper_mode > 0) {
const uint32_t *frozen_bits = nullptr;
int data_bits = 0;
switch (oper_mode) {
case 17:
data_bits = 2720;
frozen_bits = frozen_4096_2752;
break;
case 18:
data_bits = 2048;
frozen_bits = frozen_4096_2080;
break;
case 19:
data_bits = 1360;
frozen_bits = frozen_4096_1392;
break;
default:
return;
}
for (int i = 0; i < data_bits; ++i)
mesg[i] = nrz(CODE::get_le_bit(inp, i));
crc1.reset();
@ -258,7 +347,11 @@ struct Encoder
CODE::MLS seq0(mls0_poly);
for (int j = 0, k = 0; j < cons_rows; ++j) {
for (int i = 0; i < cons_cols; ++i) {
if (i % comb_dist == comb_off) {
if (oper_mode < 25) {
prev[i] *= mod_map(code+k);
fdom[bin(i+code_off)] = prev[i];
k += mod_bits;
} else if (i % comb_dist == comb_off) {
prev[i] *= nrz(seq0());
fdom[bin(i+code_off)] = prev[i];
} else {
@ -323,9 +416,10 @@ int main(int argc, char **argv)
return 1;
}
const int comb_pilots = 8;
const int reserved_tones = 8;
const int band_width = 1600 + (25 * (comb_pilots + reserved_tones)) / 4;
const int comb_pilots_max = 16;
const int reserved_tones_max = 15;
const int data_carriers_max = 273;
const int band_width = (25 * (data_carriers_max + comb_pilots_max + reserved_tones_max)) / 4;
if ((output_chan == 1 && freq_off < band_width / 2) || freq_off < band_width / 2 - output_rate / 2 || freq_off > output_rate / 2 - band_width / 2) {
std::cerr << "Unsupported frequency offset." << std::endl;
@ -345,20 +439,29 @@ int main(int argc, char **argv)
std::cerr << "Couldn't open file \"" << input_name << "\" for reading." << std::endl;
return 1;
}
const int data_len = 340;
const int data_len = 768;
uint8_t *input_data = new uint8_t[data_len];
for (int i = 0; i < data_len; ++i)
input_data[i] = std::max(input_file.get(), 0);
int oper_mode = 0;
for (int i = 256; i < 340; ++i)
for (int i = 680; i < 768; ++i)
if (!oper_mode && input_data[i])
oper_mode = 17;
for (int i = 170; i < 256; ++i)
oper_mode = 28;
for (int i = 384; i < 680; ++i)
if (!oper_mode && input_data[i])
oper_mode = 18;
for (int i = 0; i < 170; ++i)
oper_mode = 27;
for (int i = 256; i < 384; ++i)
if (!oper_mode && input_data[i])
oper_mode = 19;
oper_mode = 26;
for (int i = 192; i < 256; ++i)
if (!oper_mode && input_data[i])
oper_mode = 25;
for (int i = 128; i < 192; ++i)
if (!oper_mode && input_data[i])
oper_mode = 24;
for (int i = 0; i < 128; ++i)
if (!oper_mode && input_data[i])
oper_mode = 23;
CODE::Xorshift32 scrambler;
for (int i = 0; i < data_len; ++i)
input_data[i] ^= scrambler();
@ -367,16 +470,16 @@ int main(int argc, char **argv)
output_file.silence(output_rate);
switch (output_rate) {
case 8000:
delete new Encoder<value, cmplx, 8000>(&output_file, input_data, freq_off, call_sign, oper_mode, reserved_tones);
delete new Encoder<value, cmplx, 8000>(&output_file, input_data, freq_off, call_sign, oper_mode);
break;
case 16000:
delete new Encoder<value, cmplx, 16000>(&output_file, input_data, freq_off, call_sign, oper_mode, reserved_tones);
delete new Encoder<value, cmplx, 16000>(&output_file, input_data, freq_off, call_sign, oper_mode);
break;
case 44100:
delete new Encoder<value, cmplx, 44100>(&output_file, input_data, freq_off, call_sign, oper_mode, reserved_tones);
delete new Encoder<value, cmplx, 44100>(&output_file, input_data, freq_off, call_sign, oper_mode);
break;
case 48000:
delete new Encoder<value, cmplx, 48000>(&output_file, input_data, freq_off, call_sign, oper_mode, reserved_tones);
delete new Encoder<value, cmplx, 48000>(&output_file, input_data, freq_off, call_sign, oper_mode);
break;
default:
std::cerr << "Unsupported sample rate." << std::endl;

View file

@ -33,8 +33,11 @@ void code(int N, int K)
int main()
{
code<12>(4096, 2720+32);
code<13>(8192, 6144+32);
code<13>(8192, 5440+32);
code<12>(4096, 3072+32);
code<12>(4096, 2048+32);
code<12>(4096, 1360+32);
code<11>(2048, 1536+32);
code<11>(2048, 1024+32);
return 0;
}

View file

@ -1,3 +1,6 @@
static const uint32_t frozen_4096_2752[128] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff, 0x17ffffff, 0x117177f, 0xffffffff, 0xffffffff, 0xffffffff, 0x17ffffff, 0xffffffff, 0x177f7fff, 0x37f7fff, 0x1011f, 0x7fffffff, 0x11f7fff, 0x11717ff, 0x10117, 0x117177f, 0x7, 0x1, 0x0, 0xffffffff, 0xffffffff, 0x7fffffff, 0x17f7fff, 0x7fffffff, 0x11717ff, 0x117177f, 0x17, 0x177fffff, 0x17177f, 0x1077f, 0x1, 0x1011f, 0x1, 0x1, 0x0, 0x77f7fff, 0x1013f, 0x10117, 0x1, 0x10117, 0x1, 0x1, 0x0, 0x10117, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x7fffffff, 0x17ffffff, 0x117177f, 0x177f7fff, 0x1037f, 0x1011f, 0x1, 0x11f7fff, 0x10117, 0x10117, 0x1, 0x10117, 0x0, 0x0, 0x0, 0x11717ff, 0x10117, 0x17, 0x0, 0x3, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x17177f, 0x7, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
static const uint32_t frozen_8192_6176[256] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x177f7fff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0x7fffffff, 0x11717ff, 0xffffffff, 0x1fffffff, 0x177fffff, 0x117177f, 0x177f7fff, 0x1017f, 0x10117, 0x1, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0x177fffff, 0x177f7fff, 0x1077f, 0x7fffffff, 0x177f7fff, 0x11f7fff, 0x10117, 0x11717ff, 0x10117, 0x10117, 0x0, 0x7fffffff, 0x11717ff, 0x117177f, 0x10117, 0x17177f, 0x3, 0x1, 0x0, 0x1077f, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0x7fffffff, 0x177f7fff, 0x7fffffff, 0x1173fff, 0x11717ff, 0x10117, 0x17ffffff, 0x117177f, 0x17177f, 0x3, 0x1077f, 0x1, 0x1, 0x0, 0x177f7fff, 0x3077f, 0x1013f, 0x1, 0x10117, 0x1, 0x1, 0x0, 0x10117, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x13f7fff, 0x10117, 0x10117, 0x1, 0x10117, 0x1, 0x1, 0x0, 0x10117, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x117, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x7fffffff, 0x17ffffff, 0x117177f, 0x177f7fff, 0x7177f, 0x1017f, 0x1, 0x37f7fff, 0x1011f, 0x10117, 0x1, 0x10117, 0x1, 0x1, 0x0, 0x1171fff, 0x10117, 0x10117, 0x1, 0x10117, 0x0, 0x0, 0x0, 0x17, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x117177f, 0x10117, 0x117, 0x0, 0x7, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x117177f, 0x7, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
static const uint32_t frozen_8192_5472[256] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x177fffff, 0xffffffff, 0x177f7fff, 0x11f7fff, 0x10117, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x177f7fff, 0xffffffff, 0xffffffff, 0x7fffffff, 0x11f7fff, 0x1fffffff, 0x117177f, 0x117177f, 0x17, 0xffffffff, 0x7fffffff, 0x17ffffff, 0x117177f, 0x177f7fff, 0x1077f, 0x1011f, 0x1, 0x13f7fff, 0x10117, 0x10117, 0x1, 0x10117, 0x1, 0x1, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff, 0x1fffffff, 0x117177f, 0xffffffff, 0x17ffffff, 0x177f7fff, 0x3177f, 0x37f7fff, 0x1011f, 0x10117, 0x1, 0x7fffffff, 0x77f7fff, 0x11f7fff, 0x10117, 0x11717ff, 0x10117, 0x10117, 0x0, 0x117177f, 0x17, 0x3, 0x0, 0x1, 0x0, 0x0, 0x0, 0x7fffffff, 0x11717ff, 0x117177f, 0x117, 0x17177f, 0x3, 0x1, 0x0, 0x1037f, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1011f, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0x177fffff, 0xffffffff, 0x177f7fff, 0x11f7fff, 0x10117, 0x7fffffff, 0x1171fff, 0x117177f, 0x10117, 0x117177f, 0x17, 0x3, 0x0, 0x17ffffff, 0x117177f, 0x7177f, 0x1, 0x1017f, 0x1, 0x1, 0x0, 0x10117, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x177f7fff, 0x1037f, 0x1011f, 0x1, 0x10117, 0x1, 0x1, 0x0, 0x10117, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x10117, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11f7fff, 0x10117, 0x10117, 0x1, 0x10117, 0x1, 0x1, 0x0, 0x10117, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x17, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
static const uint32_t frozen_4096_3104[128] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x17ffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x177f7fff, 0x7fffffff, 0x1173fff, 0x11717ff, 0x10117, 0xffffffff, 0x7fffffff, 0x7fffffff, 0x11717ff, 0x177fffff, 0x17177f, 0x1077f, 0x1, 0x177f7fff, 0x1017f, 0x10117, 0x1, 0x10117, 0x1, 0x1, 0x0, 0xffffffff, 0x17ffffff, 0x177f7fff, 0x1037f, 0x13f7fff, 0x10117, 0x10117, 0x1, 0x11717ff, 0x10117, 0x10117, 0x0, 0x17, 0x0, 0x0, 0x0, 0x117177f, 0x17, 0x3, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7fffffff, 0x13f7fff, 0x1171fff, 0x10117, 0x117177f, 0x117, 0x7, 0x0, 0x7177f, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1017f, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10117, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
static const uint32_t frozen_4096_2080[128] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x17ffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x77f7fff, 0x7fffffff, 0x1173fff, 0x11717ff, 0x117, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0x11f7fff, 0xffffffff, 0x7fffffff, 0x1fffffff, 0x117177f, 0x177fffff, 0x1077f, 0x1013f, 0x1, 0xffffffff, 0x177fffff, 0x177f7fff, 0x1013f, 0x11f7fff, 0x10117, 0x10117, 0x1, 0x11717ff, 0x117, 0x7, 0x0, 0x1, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0x17ffffff, 0x177fffff, 0x1077f, 0xffffffff, 0x177f7fff, 0x11f7fff, 0x10117, 0x11717ff, 0x10117, 0x17, 0x0, 0x7fffffff, 0x1171fff, 0x117177f, 0x17, 0x3177f, 0x1, 0x1, 0x0, 0x1017f, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x177fffff, 0x7177f, 0x1037f, 0x1, 0x1011f, 0x1, 0x1, 0x0, 0x10117, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10117, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
static const uint32_t frozen_4096_1392[128] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0x13f7fff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff, 0x17ffffff, 0x17177f, 0xffffffff, 0xffffffff, 0xffffffff, 0x1fffffff, 0xffffffff, 0x177fffff, 0x37f7fff, 0x1011f, 0x7fffffff, 0x13f7fff, 0x1171fff, 0x117, 0x17177f, 0x3, 0x1, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x177fffff, 0xffffffff, 0x37f7fff, 0x1173fff, 0x10117, 0xffffffff, 0xffffffff, 0x7fffffff, 0x11f7fff, 0x3fffffff, 0x11717ff, 0x7177f, 0x1, 0x177fffff, 0x1077f, 0x1013f, 0x1, 0x10117, 0x1, 0x1, 0x0, 0xffffffff, 0x3fffffff, 0x177fffff, 0x7177f, 0x77f7fff, 0x1013f, 0x10117, 0x1, 0x1177fff, 0x10117, 0x117, 0x0, 0x7, 0x0, 0x0, 0x0, 0x117177f, 0x17, 0x3, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
static const uint32_t frozen_2048_1568[64] = { 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0x177fffff, 0x177f7fff, 0x1017f, 0x7fffffff, 0x37f7fff, 0x1173fff, 0x10117, 0x11717ff, 0x17, 0x3, 0x0, 0x7fffffff, 0x11717ff, 0x17177f, 0x3, 0x1077f, 0x1, 0x1, 0x0, 0x1011f, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x177fffff, 0x3077f, 0x1013f, 0x1, 0x10117, 0x1, 0x1, 0x0, 0x10117, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x117, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };
static const uint32_t frozen_2048_1056[64] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0x177fffff, 0x177f7fff, 0x1017f, 0xffffffff, 0xffffffff, 0xffffffff, 0x177f7fff, 0x7fffffff, 0x13f7fff, 0x1171fff, 0x117, 0x3fffffff, 0x11717ff, 0x7177f, 0x1, 0x1017f, 0x1, 0x1, 0x0, 0xffffffff, 0x7fffffff, 0x7fffffff, 0x1171fff, 0x17ffffff, 0x7177f, 0x1037f, 0x1, 0x77f7fff, 0x1013f, 0x10117, 0x1, 0x10117, 0x0, 0x0, 0x0, 0x1173fff, 0x10117, 0x117, 0x0, 0x7, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, };