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 <cstdlib>
30#include <deque>
31#include <vector>
32
33
34namespace gr {
35namespace satnogs {
36
37/*!
38 * \brief CW decoder based on overlapping FFT
39 *
40 */
42{
43public:
44 using sptr = std::shared_ptr<cw_decoder>;
45 static sptr make(double samp_rate,
46 int fft_len,
47 int overlapping,
48 float wpm = 22.0,
49 float snr = 10.0,
50 float confidence = 0.9,
51 size_t channels = 16,
52 size_t min_frame_size = 5,
53 size_t max_frame_size = 256);
54
55 cw_decoder(double samp_rate,
56 int fft_len,
57 int overlapping,
58 float wpm,
59 float snr,
60 float confidence,
61 size_t channels,
62 size_t min_frame_size,
63 size_t max_frame_size);
65
66
67 decoder_status_t decode(const void* in, int len);
68
69 void reset();
70
71 size_t input_multiple() const;
72
73private:
74 const double d_samp_rate;
75 const int d_fft_len;
76 const int d_overlapping;
77 const float d_wpm;
78 const float d_snr;
79 const float d_confidence;
80 const size_t d_min_frame_size;
81 const int d_new_samples;
82 const int d_shift_len;
83 const float d_fft_duration;
84 const size_t d_dot_duration;
85 int d_channels_num;
86 int d_channel_carriers;
87 int d_nf_est_remaining;
88 int d_dirty_samples;
89 std::vector<cw_decoder_priv*> d_decoders;
90 gr::fft::fft_complex_fwd* d_fft;
91 gr_complex* d_tmp_buf;
92 float* d_nf_buf;
93 float* d_psd;
94 std::deque<decoder_status_t> d_frames;
95
96 void process_psd();
97
98 void process_windows();
99
100 void calc_nf();
101};
102
103} // namespace satnogs
104} // namespace gr
105
106#endif /* INCLUDED_SATNOGS_CW_DECODER_H */
#define SATNOGS_API
Definition: api.h:19
CW decoder based on overlapping FFT.
Definition: cw_decoder.h:42
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:44
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