aicodix___modem/freezer.cc
Ahmet Inan 99b6a4e963 use a shortened systematic polar code and CA-SCL decoding
using SPC(64800, 43072):
mode 6: 8PSK, 2700 Hz BW and about 10 seconds long
mode 7: 8PSK, 2500 Hz BW and about 11 seconds long
mode 8: QPSK, 2500 Hz BW and about 16 seconds long
mode 9: QPSK, 2250 Hz BW and about 18 seconds long

using SPC(64512, 43072):
mode 10: 8PSK, 3200 Hz BW and about 9 seconds long
mode 11: 8PSK, 2400 Hz BW and about 11 seconds long
mode 12: QPSK, 2400 Hz BW and about 16 seconds long
mode 13: QPSK, 1600 Hz BW and about 24 seconds long
2021-09-03 20:52:09 +02:00

39 lines
1.1 KiB
C++

/*
Table generator for frozen bits
Copyright 2021 Ahmet Inan <inan@aicodix.de>
*/
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <functional>
#include "polar_freezer.hh"
template <int M>
void code(int N, int K)
{
long double erasure_probability = (long double)(N - K) / N;
double design_SNR = 10 * std::log10(-std::log(erasure_probability));
std::cerr << "design SNR: " << design_SNR << std::endl;
auto freeze = new CODE::PolarCodeConst0<M>;
double better_SNR = design_SNR + 1.59175;
std::cerr << "better SNR: " << better_SNR << std::endl;
long double better_probability = std::exp(-pow(10.0, better_SNR / 10));
auto frozen = new uint32_t[1<<(M-5)];
(*freeze)(frozen, M, K+(1<<M)-N, better_probability);
delete freeze;
std::cout << "static const uint32_t frozen_" << std::dec << N << "_" << K << "[" << (1<<(M-5)) << "] = { " << std::hex;
for (int i = 0; i < 1<<(M-5); ++i)
std::cout << "0x" << frozen[i] << ", ";
std::cout << "};" << std::endl;
}
int main()
{
code<16>(64512, 43040+32);
code<16>(64800, 43040+32);
return 0;
}