kopia lustrzana https://github.com/mobilinkd/m17-cxx-demod
Merge pull request #17 from n1ai/master
m17-cxx-demod builds under conda for linux and mac osxpull/18/head
commit
fcfa14969f
|
@ -22,7 +22,6 @@
|
|||
#include <thread>
|
||||
|
||||
#include <array>
|
||||
#include <experimental/array>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <atomic>
|
||||
|
@ -34,12 +33,12 @@
|
|||
#include <signal.h>
|
||||
|
||||
// Generated using scikit-commpy
|
||||
const auto rrc_taps = std::experimental::make_array<double>(
|
||||
const auto rrc_taps = std::array<double, 150>{
|
||||
0.0029364388513841593, 0.0031468394550958484, 0.002699564567597445, 0.001661182944400927, 0.00023319405581230247, -0.0012851320781224025, -0.0025577136087664687, -0.0032843366522956313, -0.0032697038088887226, -0.0024733964729590865, -0.0010285696910973807, 0.0007766690889758685, 0.002553421969211845, 0.0038920145144327816, 0.004451886520053017, 0.00404219185231544, 0.002674727068399207, 0.0005756567993179152, -0.0018493784971116507, -0.004092346891623224, -0.005648131453822014, -0.006126925416243605, -0.005349511529163396, -0.003403189203405097, -0.0006430502751187517, 0.002365929161655135, 0.004957956568090113, 0.006506845894531803, 0.006569574194782443, 0.0050017573119839134, 0.002017321931508163, -0.0018256054303579805, -0.00571615173291049, -0.008746639552588416, -0.010105075751866371, -0.009265784007800534, -0.006136551625729697, -0.001125978562075172, 0.004891777252042491, 0.01071805138282269, 0.01505751553351295, 0.01679337935001369, 0.015256245142156299, 0.01042830577908502, 0.003031522725559901, -0.0055333532968188165, -0.013403099825723372, -0.018598682349642525, -0.01944761739590459, -0.015005271935951746, -0.0053887880354343935, 0.008056525910253532, 0.022816244158307273, 0.035513467692208076, 0.04244131815783876, 0.04025481153629372, 0.02671818654865632, 0.0013810216516704976, -0.03394615682795165, -0.07502635967975885, -0.11540977897637611, -0.14703962203941534, -0.16119995609538576, -0.14969512896336504, -0.10610329539459686, -0.026921412469634916, 0.08757875030779196, 0.23293327870303457, 0.4006012210123992, 0.5786324696325503, 0.7528286479934068, 0.908262741447522, 1.0309661131633199, 1.1095611856548013, 1.1366197723675815, 1.1095611856548013, 1.0309661131633199, 0.908262741447522, 0.7528286479934068, 0.5786324696325503, 0.4006012210123992, 0.23293327870303457, 0.08757875030779196, -0.026921412469634916, -0.10610329539459686, -0.14969512896336504, -0.16119995609538576, -0.14703962203941534, -0.11540977897637611, -0.07502635967975885, -0.03394615682795165, 0.0013810216516704976, 0.02671818654865632, 0.04025481153629372, 0.04244131815783876, 0.035513467692208076, 0.022816244158307273, 0.008056525910253532, -0.0053887880354343935, -0.015005271935951746, -0.01944761739590459, -0.018598682349642525, -0.013403099825723372, -0.0055333532968188165, 0.003031522725559901, 0.01042830577908502, 0.015256245142156299, 0.01679337935001369, 0.01505751553351295, 0.01071805138282269, 0.004891777252042491, -0.001125978562075172, -0.006136551625729697, -0.009265784007800534, -0.010105075751866371, -0.008746639552588416, -0.00571615173291049, -0.0018256054303579805, 0.002017321931508163, 0.0050017573119839134, 0.006569574194782443, 0.006506845894531803, 0.004957956568090113, 0.002365929161655135, -0.0006430502751187517, -0.003403189203405097, -0.005349511529163396, -0.006126925416243605, -0.005648131453822014, -0.004092346891623224, -0.0018493784971116507, 0.0005756567993179152, 0.002674727068399207, 0.00404219185231544, 0.004451886520053017, 0.0038920145144327816, 0.002553421969211845, 0.0007766690889758685, -0.0010285696910973807, -0.0024733964729590865, -0.0032697038088887226, -0.0032843366522956313, -0.0025577136087664687, -0.0012851320781224025, 0.00023319405581230247, 0.001661182944400927, 0.002699564567597445, 0.0031468394550958484, 0.0029364388513841593, 0.0
|
||||
);
|
||||
};
|
||||
|
||||
const auto evm_b = std::experimental::make_array<double>(0.02008337, 0.04016673, 0.02008337);
|
||||
const auto evm_a = std::experimental::make_array<double>(1.0, -1.56101808, 0.64135154);
|
||||
const auto evm_b = std::array<double, 3>{0.02008337, 0.04016673, 0.02008337};
|
||||
const auto evm_a = std::array<double, 3>{1.0, -1.56101808, 0.64135154};
|
||||
|
||||
const char VERSION[] = "2.2";
|
||||
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
# define __builtin_popcount __popcnt
|
||||
#endif
|
||||
|
||||
namespace mobilinkd
|
||||
{
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "SymbolEvm.h"
|
||||
|
||||
#include <array>
|
||||
#include <experimental/array>
|
||||
#include <optional>
|
||||
#include <tuple>
|
||||
|
||||
|
@ -18,7 +17,7 @@ namespace mobilinkd
|
|||
|
||||
namespace detail
|
||||
{
|
||||
inline const auto rrc_taps = std::experimental::make_array<double>(
|
||||
inline const auto rrc_taps = std::array<double, 79>(
|
||||
-0.009265784007800534, -0.006136551625729697, -0.001125978562075172, 0.004891777252042491,
|
||||
0.01071805138282269, 0.01505751553351295, 0.01679337935001369, 0.015256245142156299,
|
||||
0.01042830577908502, 0.003031522725559901, -0.0055333532968188165, -0.013403099825723372,
|
||||
|
@ -41,8 +40,8 @@ inline const auto rrc_taps = std::experimental::make_array<double>(
|
|||
-0.001125978562075172, -0.006136551625729697, -0.009265784007800534
|
||||
);
|
||||
|
||||
inline const auto evm_b = std::experimental::make_array<double>(0.02008337, 0.04016673, 0.02008337);
|
||||
inline const auto evm_a = std::experimental::make_array<double>(1.0, -1.56101808, 0.64135154);
|
||||
inline const auto evm_b = std::array<double, 3>(0.02008337, 0.04016673, 0.02008337);
|
||||
inline const auto evm_a = std::array<double, 3>(1.0, -1.56101808, 0.64135154);
|
||||
} // detail
|
||||
|
||||
struct Fsk4Demod
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
# define __builtin_popcount __popcnt
|
||||
#endif
|
||||
|
||||
namespace mobilinkd {
|
||||
|
||||
// Parts are adapted from:
|
||||
|
|
|
@ -30,7 +30,7 @@ struct Taps
|
|||
template <>
|
||||
struct Taps<double>
|
||||
{
|
||||
static constexpr auto rrc_taps = std::experimental::make_array<double>(
|
||||
static constexpr auto rrc_taps = std::array<double, 150>{
|
||||
0.0029364388513841593, 0.0031468394550958484, 0.002699564567597445, 0.001661182944400927,
|
||||
0.00023319405581230247, -0.0012851320781224025, -0.0025577136087664687, -0.0032843366522956313,
|
||||
-0.0032697038088887226, -0.0024733964729590865, -0.0010285696910973807, 0.0007766690889758685,
|
||||
|
@ -69,13 +69,13 @@ struct Taps<double>
|
|||
-0.0032697038088887226, -0.0032843366522956313, -0.0025577136087664687, -0.0012851320781224025,
|
||||
0.00023319405581230247, 0.001661182944400927, 0.002699564567597445, 0.0031468394550958484,
|
||||
0.0029364388513841593, 0.0
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Taps<float>
|
||||
{
|
||||
static constexpr auto rrc_taps = std::experimental::make_array<float>(
|
||||
static constexpr auto rrc_taps = std::array<float, 150>{
|
||||
0.0029364388513841593, 0.0031468394550958484, 0.002699564567597445, 0.001661182944400927,
|
||||
0.00023319405581230247, -0.0012851320781224025, -0.0025577136087664687, -0.0032843366522956313,
|
||||
-0.0032697038088887226, -0.0024733964729590865, -0.0010285696910973807, 0.0007766690889758685,
|
||||
|
@ -114,7 +114,7 @@ struct Taps<float>
|
|||
-0.0032697038088887226, -0.0032843366522956313, -0.0025577136087664687, -0.0012851320781224025,
|
||||
0.00023319405581230247, 0.001661182944400927, 0.002699564567597445, 0.0031468394550958484,
|
||||
0.0029364388513841593, 0.0
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <experimental/array>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
@ -594,7 +593,7 @@ public:
|
|||
static baseband_t symbols_to_baseband(const symbols_t& symbols)
|
||||
{
|
||||
// Generated using scikit-commpy
|
||||
static const auto rrc_taps = std::experimental::make_array<double>(
|
||||
static const auto rrc_taps = std::array<double, 79>{
|
||||
-0.009265784007800534, -0.006136551625729697, -0.001125978562075172, 0.004891777252042491,
|
||||
0.01071805138282269, 0.01505751553351295, 0.01679337935001369, 0.015256245142156299,
|
||||
0.01042830577908502, 0.003031522725559901, -0.0055333532968188165, -0.013403099825723372,
|
||||
|
@ -615,7 +614,7 @@ public:
|
|||
-0.0055333532968188165, 0.003031522725559901, 0.01042830577908502, 0.015256245142156299,
|
||||
0.01679337935001369, 0.01505751553351295, 0.01071805138282269, 0.004891777252042491,
|
||||
-0.001125978562075172, -0.006136551625729697, -0.009265784007800534
|
||||
);
|
||||
};
|
||||
static BaseFirFilter<double, std::tuple_size<decltype(rrc_taps)>::value> rrc = makeFirFilter(rrc_taps);
|
||||
|
||||
std::array<int16_t, 1920> baseband;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <experimental/array>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
|
@ -14,13 +13,13 @@ namespace detail
|
|||
{
|
||||
|
||||
// M17 randomization matrix.
|
||||
inline auto DC = std::experimental::make_array<uint8_t>(
|
||||
inline auto DC = std::array<uint8_t, 46>{
|
||||
0xd6, 0xb5, 0xe2, 0x30, 0x82, 0xFF, 0x84, 0x62,
|
||||
0xba, 0x4e, 0x96, 0x90, 0xd8, 0x98, 0xdd, 0x5d,
|
||||
0x0c, 0xc8, 0x52, 0x43, 0x91, 0x1d, 0xf8, 0x6e,
|
||||
0x68, 0x2F, 0x35, 0xda, 0x14, 0xea, 0xcd, 0x76,
|
||||
0x19, 0x8d, 0xd5, 0x80, 0xd1, 0x33, 0x87, 0x13,
|
||||
0x57, 0x18, 0x2d, 0x29, 0x78, 0xc3);
|
||||
0x57, 0x18, 0x2d, 0x29, 0x78, 0xc3};
|
||||
}
|
||||
|
||||
template <size_t N = 368>
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
# define __builtin_popcount __popcnt
|
||||
#endif
|
||||
|
||||
namespace mobilinkd
|
||||
{
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "Convolution.h"
|
||||
|
||||
#include <array>
|
||||
#include <experimental/array>
|
||||
#include <cstdlib>
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -31,14 +30,14 @@ inline constexpr std::array<int8_t, 61> make_p1() {
|
|||
inline constexpr auto P1 = make_p1();
|
||||
|
||||
/// Puncture matrix for audio frames. Rate 6/11.
|
||||
inline constexpr auto P2 = std::experimental::make_array<int8_t>(
|
||||
inline constexpr auto P2 = std::array<int8_t, 12>{
|
||||
1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 0);
|
||||
1, 1, 1, 1, 1, 0};
|
||||
|
||||
|
||||
/// Puncture matrix for packet frames (7/8).
|
||||
inline constexpr auto P3 = std::experimental::make_array<int8_t>(
|
||||
1, 1, 1, 1, 1, 1, 1, 0);
|
||||
inline constexpr auto P3 = std::array<int8_t, 8>{
|
||||
1, 1, 1, 1, 1, 1, 1, 0};
|
||||
|
||||
/**
|
||||
* Convert an integer value to an array of bits, with the
|
||||
|
|
|
@ -271,10 +271,10 @@ size_t puncture_bytes(const std::array<uint8_t, IN>& in,
|
|||
template <typename T, size_t n>
|
||||
constexpr T to_int(uint8_t v)
|
||||
{
|
||||
constexpr auto MAX_INPUT = (1 << (n - 1));
|
||||
constexpr auto NEGATIVE_OFFSET = std::numeric_limits<typename std::make_unsigned<T>::type>::max() - (MAX_INPUT - 1);
|
||||
constexpr auto MAX_LOCAL_INPUT = (1 << (n - 1));
|
||||
constexpr auto NEGATIVE_OFFSET = std::numeric_limits<typename std::make_unsigned<T>::type>::max() - (MAX_LOCAL_INPUT - 1);
|
||||
T r = v & (1 << (n - 1)) ? NEGATIVE_OFFSET : 0;
|
||||
return r + (v & (MAX_INPUT - 1));
|
||||
return r + (v & (MAX_LOCAL_INPUT - 1));
|
||||
}
|
||||
|
||||
template <typename T, size_t N>
|
||||
|
|
Ładowanie…
Reference in New Issue