GNU Radio's SATNOGS Package
cw_decoder.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
4 *
5 * Copyright (C) 2019, Libre Space Foundation <http://libre.space>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef INCLUDED_SATNOGS_CW_DECODER_H
22#define INCLUDED_SATNOGS_CW_DECODER_H
23
24#include <gnuradio/fft/fft.h>
29#include <volk/volk_alloc.hh>
30#include <cstdlib>
31#include <deque>
32#include <vector>
33
34
35namespace gr {
36namespace satnogs {
37
38/*!
39 * \brief CW decoder based on overlapping FFT
40 *
41 */
43{
44public:
45 using sptr = std::shared_ptr<cw_decoder>;
46 static sptr make(double samp_rate,
47 int fft_len,
48 int overlapping,
49 float wpm = 22.0,
50 float snr = 10.0,
51 float confidence = 0.9,
52 size_t channels = 16,
53 size_t min_frame_size = 5,
54 size_t max_frame_size = 256);
55
56 cw_decoder(double samp_rate,
57 int fft_len,
58 int overlapping,
59 float wpm,
60 float snr,
61 float confidence,
62 size_t channels,
63 size_t min_frame_size,
64 size_t max_frame_size);
66
67
68 decoder_status_t decode(const void* in, int len);
69
70 void reset();
71
72 size_t input_multiple() const;
73
74private:
75 const double d_samp_rate;
76 const int d_fft_len;
77 const int d_overlapping;
78 const float d_wpm;
79 const float d_snr;
80 const float d_confidence;
81 const size_t d_min_frame_size;
82 const int d_new_samples;
83 const int d_shift_len;
84 const float d_fft_duration;
85 const size_t d_dot_duration;
86 int d_channels_num;
87 int d_channel_carriers;
88 int d_nf_est_remaining;
89 int d_dirty_samples;
90 std::vector<cw_decoder_priv*> d_decoders;
91 gr::fft::fft_complex_fwd* d_fft;
92 volk::vector<gr_complex> d_tmp_buf;
93 volk::vector<float> d_nf_buf;
94 volk::vector<float> d_psd;
95 std::deque<decoder_status_t> d_frames;
96
97 void process_psd();
98
99 void process_windows();
100
101 void calc_nf();
102};
103
104} // namespace satnogs
105} // namespace gr
106
107#endif /* INCLUDED_SATNOGS_CW_DECODER_H */
#define SATNOGS_API
Definition: api.h:19
CW decoder based on overlapping FFT.
Definition: cw_decoder.h:43
static sptr make(double samp_rate, int fft_len, int overlapping, float wpm=22.0, float snr=10.0, float confidence=0.9, size_t channels=16, size_t min_frame_size=5, size_t max_frame_size=256)
decoder_status_t decode(const void *in, int len)
std::shared_ptr< cw_decoder > sptr
Definition: cw_decoder.h:45
size_t input_multiple() const
cw_decoder(double samp_rate, int fft_len, int overlapping, float wpm, float snr, float confidence, size_t channels, size_t min_frame_size, size_t max_frame_size)
Abstract class that provided the API for the c decoders.
Definition: decoder.h:71
class decoder_status decoder_status_t
Definition: decoder.h:56
Definition: amsat_duv_decoder.h:29