GNU Radio's IRIDIUM_TOOLKIT Package
fft_burst_tagger_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2016 Free Software Foundation, Inc
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_IRIDIUM_TOOLKIT_FFT_BURST_TAGGER_IMPL_H
22 #define INCLUDED_IRIDIUM_TOOLKIT_FFT_BURST_TAGGER_IMPL_H
23 
25 #include <gnuradio/fft/fft.h>
26 
27 namespace gr {
28  namespace iridium {
29 
30  struct burst {
31  uint64_t start;
32  uint64_t stop;
33  uint64_t last_active;
35  float magnitude;
36  uint64_t id;
37  };
38 
39  struct peak {
40  int bin;
42  };
43 
45  {
46  private:
47  bool d_history_primed;
48  bool d_debug;
49 
50  int d_fft_size;
51  int d_burst_pre_len;
52  int d_history_size;
53  int d_burst_width;
54  int d_history_index;
55  int d_burst_post_len;
56  int d_max_bursts;
57  int d_sample_rate;
58  uint64_t d_index;
59  uint64_t d_burst_id;
60  uint64_t d_n_tagged_bursts;
61 
62  float * d_window_f;
63  float * d_magnitude_f;
64  float * d_magnitude_shifted_f;
65  float * d_baseline_sum_f;
66  float * d_baseline_history_f;
67  float * d_relative_magnitude_f;
68  float * d_burst_mask_f;
69  float * d_ones_f;
70  float d_threshold;
71  float d_center_frequency;
72 
73  FILE * d_burst_debug_file;
74 
75  gr::fft::fft_complex *d_fft;
76  std::vector<peak> d_peaks;
77  std::vector<burst> d_bursts;
78  std::vector<burst> d_new_bursts;
79  std::vector<burst> d_gone_bursts;
80 
81  bool update_filters_pre(void);
82  void update_filters_post(void);
83  void extract_peaks(void);
84  void save_peaks_to_debug_file(char * filename);
85  void remove_peaks_around_bursts(void);
86  void update_burst_mask(void);
87  void update_bursts(void);
88  void delete_gone_bursts(void);
89  void create_new_bursts(void);
90  void mask_burst(burst &b);
91  void tag_new_bursts(void);
92  void tag_gone_bursts(int noutput_items);
93 
94  public:
95  fft_burst_tagger_impl(float center_frequency, int fft_size, int sample_rate,
96  int burst_pre_len, int burst_post_len, int burst_width,
97  int max_bursts, float threshold, int history_size, bool debug);
99 
100  uint64_t get_n_tagged_bursts();
101 
102  int work(int noutput_items,
103  gr_vector_const_void_star &input_items,
104  gr_vector_void_star &output_items);
105  };
106 
107  } // namespace iridium
108 } // namespace gr
109 
110 #endif /* INCLUDED_IRIDIUM_TOOLKIT_FFT_BURST_TAGGER_IMPL_H */
111 
int bin
Definition: fft_burst_tagger_impl.h:40
uint64_t id
Definition: fft_burst_tagger_impl.h:36
Definition: fft_burst_tagger_impl.h:44
Definition: fft_burst_tagger_impl.h:30
uint64_t start
Definition: fft_burst_tagger_impl.h:31
fft_burst_tagger_impl(float center_frequency, int fft_size, int sample_rate, int burst_pre_len, int burst_post_len, int burst_width, int max_bursts, float threshold, int history_size, bool debug)
<+description of block+>
Definition: fft_burst_tagger.h:36
Definition: fft_burst_tagger_impl.h:39
uint64_t stop
Definition: fft_burst_tagger_impl.h:32
uint64_t last_active
Definition: fft_burst_tagger_impl.h:33
int center_bin
Definition: fft_burst_tagger_impl.h:34
float relative_magnitude
Definition: fft_burst_tagger_impl.h:41
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
float magnitude
Definition: fft_burst_tagger_impl.h:35