Radio Control  Control Software and GUI for the Panoradio SDR, by DC9ST 2016
fftw_base.h
1 #ifndef FFTW_BASE_H
2 #define FFTW_BASE_H
3 
4 #include <iostream>
5 #include<fftw3.h>
6 
7 
9 class fftw_base
10 {
11 
12 public:
14  enum t_fft_window {no, hann, flat};
15 
19  fftw_base(int n, t_fft_window fft_window);
20 
22  virtual ~fftw_base();
23 
24 
25 protected:
26 
28  int n_;
29 
31  double resistor_ref_;
32 
35 
38 
41 
44 
46  double *window_weights_;
47 
49  fftw_plan *my_fftw_plan_;
50 
52  fftw_complex *in_;
53 
55  fftw_complex *out_;
56 
59 
60 
61 
65  void real_fft_linear_power(double data_in[], double data_out_mag[]);
66 
71  void complex_fft_linear_power(double data_in_real[], double data_in_imag[], double data_out_mag[]);
72 
73 
76  void linear2dbm_real(double data_out_mag[]);
77 
80  void linear2dbm_complex(double data_out_mag[]);
81 
82 
85  void correct_coherent_gain_real(double data_out_mag[]);
86 
89  void correct_coherent_gain_complex(double data_out_mag[]);
90 };
91 
92 #endif // FFTW_BASE_H
void correct_coherent_gain_real(double data_out_mag[])
corrects the coherent power gain (caused by windowing) of a power spectrum in dBm of real input value...
Definition: fftw_base.cpp:109
fftw_plan * my_fftw_plan_
FFTW specific module for FFT calculation.
Definition: fftw_base.h:49
t_fft_window fft_window_
selected window
Definition: fftw_base.h:43
void complex_fft_linear_power(double data_in_real[], double data_in_imag[], double data_out_mag[])
performs FFT on complex input values, including windowing, no CPG correction
Definition: fftw_base.cpp:116
void correct_coherent_gain_complex(double data_out_mag[])
corrects the coherent power gain (caused by windowing) of a power spectrum in dBm of complex input va...
Definition: fftw_base.cpp:163
void real_fft_linear_power(double data_in[], double data_out_mag[])
performs FFT on real input values, including windowing, no CPG correction
Definition: fftw_base.cpp:69
double resistor_ref_
resistance in Ohms of a resistor over which the input voltage occurs
Definition: fftw_base.h:31
fftw_base(int n, t_fft_window fft_window)
constructor, allocates memory, sets parameter for magnitude calculation and windowing coefficients ...
Definition: fftw_base.cpp:6
fftw_complex * out_
FFTW specific buffer for FFT output data.
Definition: fftw_base.h:55
double * data_out_mag_complex_temp_
temporary array required when reordering the bins of a complex FFT
Definition: fftw_base.h:58
Base class for FFT for time domain voltage input data from an ADC (wrapped FFTW)
Definition: fftw_base.h:9
virtual ~fftw_base()
destructor
Definition: fftw_base.cpp:59
t_fft_window
window types
Definition: fftw_base.h:14
double * window_weights_
pointer to array of window weight coefficients
Definition: fftw_base.h:46
void linear2dbm_real(double data_out_mag[])
converts a linear scaled power spectrum of real input values into a power spectrum in dBm (same as "l...
Definition: fftw_base.cpp:103
void linear2dbm_complex(double data_out_mag[])
converts a linear scaled power spectrum of complex input values into a power spectrum in dBm (same as...
Definition: fftw_base.cpp:158
fftw_complex * in_
FFTW specific buffer for FFT input data.
Definition: fftw_base.h:52
double adc_full_scale_voltage_
full scale voltage of ADC in Volts
Definition: fftw_base.h:34
double coherent_gain_
coherent power gain of selected window
Definition: fftw_base.h:40
int n_
FFT size.
Definition: fftw_base.h:28
int num_adc_bits_
number of ADC bits
Definition: fftw_base.h:37