M17: M17Demodulator M17FrameDecoder and M17Framer code cleanup

pull/1370/head
f4exb 2022-07-27 23:38:35 +02:00
rodzic 820a5dc992
commit 8e1d5a3bbd
3 zmienionych plików z 9 dodań i 16 usunięć

Wyświetl plik

@ -27,14 +27,8 @@ struct MODEMM17_API M17Demodulator
static const uint16_t SYMBOL_RATE = 4800; static const uint16_t SYMBOL_RATE = 4800;
static const uint16_t SAMPLES_PER_SYMBOL = SAMPLE_RATE / SYMBOL_RATE; static const uint16_t SAMPLES_PER_SYMBOL = SAMPLE_RATE / SYMBOL_RATE;
static const uint16_t BLOCK_SIZE = 192; static const uint16_t BLOCK_SIZE = 192;
static constexpr float sample_rate = SAMPLE_RATE;
static constexpr float symbol_rate = SYMBOL_RATE;
static const uint8_t MAX_MISSING_SYNC = 8; static const uint8_t MAX_MISSING_SYNC = 8;
using collelator_t = Correlator;
using sync_word_t = SyncWord;
using callback_t = M17FrameDecoder::callback_t; using callback_t = M17FrameDecoder::callback_t;
using diagnostic_callback_t = std::function<void(bool, float, float, float, int, int, float, int, int, int, int)>; using diagnostic_callback_t = std::function<void(bool, float, float, float, int, int, float, int, int, int, int)>;
@ -50,9 +44,9 @@ struct MODEMM17_API M17Demodulator
DataCarrierDetect<SAMPLE_RATE, 500> dcd{2500, 4000, 1.0, 4.0}; DataCarrierDetect<SAMPLE_RATE, 500> dcd{2500, 4000, 1.0, 4.0};
ClockRecovery clock_recovery; ClockRecovery clock_recovery;
sync_word_t preamble_sync{{+3, -3, +3, -3, +3, -3, +3, -3}, 29.f}; SyncWord preamble_sync{{+3, -3, +3, -3, +3, -3, +3, -3}, 29.f};
sync_word_t lsf_sync{ {+3, +3, +3, +3, -3, -3, +3, -3}, 32.f, -31.f}; // LSF or STREAM (inverted) SyncWord lsf_sync{ {+3, +3, +3, +3, -3, -3, +3, -3}, 32.f, -31.f}; // LSF or STREAM (inverted)
sync_word_t packet_sync{ {+3, -3, +3, +3, -3, -3, -3, -3}, 31.f, -31.f}; // PACKET or BERT (inverted) SyncWord packet_sync{ {+3, -3, +3, +3, -3, -3, -3, -3}, 31.f, -31.f}; // PACKET or BERT (inverted)
FreqDevEstimator dev; FreqDevEstimator dev;
float idev; float idev;
@ -117,7 +111,7 @@ struct MODEMM17_API M17Demodulator
private: private:
static const std::array<float, 150> rrc_taps; static const std::array<float, 150> rrc_taps;
BaseFirFilter<rrc_taps.size()> demod_filter{rrc_taps}; BaseFirFilter<rrc_taps.size()> demod_filter{rrc_taps};
collelator_t correlator; Correlator correlator;
int16_t initializing_count_; int16_t initializing_count_;
}; };

Wyświetl plik

@ -39,7 +39,7 @@ QString dump(const std::array<C,N>& data, char header = 'D')
struct M17FrameDecoder struct M17FrameDecoder
{ {
static constexpr size_t MAX_LICH_FRAGMENT = 5; static const size_t MAX_LICH_FRAGMENT = 5;
M17Randomizer<368> derandomize_; M17Randomizer<368> derandomize_;
PolynomialInterleaver<45, 92, 368> interleaver_; PolynomialInterleaver<45, 92, 368> interleaver_;

Wyświetl plik

@ -13,11 +13,6 @@ namespace modemm17
template <size_t N = 368> template <size_t N = 368>
struct M17Framer struct M17Framer
{ {
using buffer_t = std::array<int8_t, N>;
alignas(16) buffer_t buffer_;
size_t index_ = 0;
M17Framer() M17Framer()
{ {
reset(); reset();
@ -57,6 +52,10 @@ struct M17Framer
buffer_.fill(0); buffer_.fill(0);
index_ = 0; index_ = 0;
} }
private:
alignas(16) std::array<int8_t, N> buffer_;
size_t index_ = 0;
}; };
} // modemm17 } // modemm17