1 // Copyright (c) <2012> <Leif Asbrink>
2 //
3 // Permission is hereby granted, free of charge, to any person
4 // obtaining a copy of this software and associated documentation
5 // files (the "Software"), to deal in the Software without restriction,
6 // including without limitation the rights to use, copy, modify,
7 // merge, publish, distribute, sublicense, and/or sell copies of
8 // the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21 // OR OTHER DEALINGS IN THE SOFTWARE.
22 
23 
24 #include "globdef.h"
25 #include "seldef.h"
26 
27 
28 int yieldflag_ndsp_mix1;
29 int freq_readout_x1;
30 int freq_readout_x2;
31 int freq_readout_y1;
32 int netslaves_selfreq[MAX_NETSLAVES];
33 float netslaves_time[MAX_NETSLAVES];
34 int netfreq_list[MAX_FREQLIST];
35 float netfreq_time[MAX_FREQLIST];
36 int netfreq_curx[MAX_FREQLIST];
37 int new_netfreq_curx[MAX_FREQLIST];
38 
39 int enable_resamp_iir5;
40 IIR5_PARMS iir_a, iir_b;
41 float xva1[6],yva1[6];
42 float xvb1[6],yvb1[6];
43 float xva2[6],yva2[6];
44 float xvb2[6],yvb2[6];
45 float xv1[4], yv1[4];
46 float xv2[4], yv2[4];
47 float xv3[4], yv3[4];
48 float xv4[4], yv4[4];
49 float out1, out2, old_out1, old_out2;
50 float out3, out4, old_out3, old_out4;
51 
52 int spursearch_sum_counter;
53 float *spursearch_powersum;
54 TWOCHAN_POWER *spursearch_xysum;
55 float *spursearch_spectrum;
56 int spur_search_first_point;
57 int spur_search_last_point;
58 int basebnet_px;
59 int basebnet_pa;
60 char *baseb_netsend_buffer;
61 int basebnet_mask;
62 int basebnet_size;
63 
64 char *basebraw_netsend_buffer;
65 int basebrawnet_mask;
66 int basebrawnet_size;
67 int basebrawnet_pa;
68 int basebrawnet_px;
69 float basebraw_sampling_speed;
70 int basebraw_ad_channels;
71 int basebraw_rf_channels;
72 int basebraw_mode;
73 int basebraw_passband_direction;
74 float *fftx;
75 float *fftx_pwr;
76 TWOCHAN_POWER *fftx_xypower;
77 MEMREF_T *afc_handle;
78 float *afc_spectrum;
79 float *afc_lowres_spectrum;
80 float *afct_window;
81 float *ag_fitted_fq;
82 float *ag_mix1freq;
83 float *ag_freq;
84 float *ag_ston;
85 TWOCHAN_POWER *afc_xysum;
86 char *ag_background;
87 short int *ag_oldpix;
88 char *ag_stonbuf;
89 char *ag_srchbuf;
90 char *ag_lockbuf;
91 
92 float mix1_lowest_fq;
93 float mix1_highest_fq;
94 
95 float *mix1_fqwin;
96 float *mix1_fq_mid;
97 float *mix1_fq_start;
98 float *mix1_fq_curv;
99 float *mix1_fq_slope;
100 short int *mix1_eval_avgn;
101 float *mix1_eval_fq;
102 float *mix1_eval_sigpwr;
103 float *mix1_eval_noise;
104 float *mix1_fitted_fq;
105 
106 float *spur_table;
107 short int *spur_table_mmx;
108 int *spur_location;
109 int *spur_flag;
110 float *spur_power;
111 float *spur_d0pha;
112 float *spur_d1pha;
113 float *spur_d2pha;
114 float *spur_avgd2;
115 float *spur_pol;
116 float *spur_spectra;
117 float *spur_freq;
118 float *sp_sig;
119 float *sp_pha;
120 float *sp_der;
121 float *sp_tmp;
122 float *spur_signal;
123 float *spur_ampl;
124 float *spur_noise;
125 int *spur_ind;
126 float sp_c1, sp_c2, sp_c3;
127 int sp_avgnum;
128 int sp_numsub;
129 int no_of_spurs;
130 int spur_block;
131 int spurno;
132 int spurp0;
133 int spur_speknum;
134 float spur_max_d2;
135 float spur_minston;
136 float spur_freq_factor;
137 TWOCHAN_POWER spur_pxy[SPUR_WIDTH];
138 float sp_d0;
139 float sp_d1;
140 float sp_d2;
141 float spur_weiold;
142 float spur_weinew;
143 float spur_linefit;
144 int fftx_na;
145 int fftx_nc;
146 int fftx_nm;
147 int fftx_nx;
148 int fftx_ny;
149 int fftx_nf1;
150 int fftx_nf2;
151 int max_fftxn;
152 int fftxn_mask;
153 int fftx_size;
154 int ffts_na;
155 int ffts_nm;
156 
157 int ag_first_xpixel;
158 int ag_xpixels;
159 int ag_size;
160 int ag_pa;
161 int ag_px;
162 int ag_ps;
163 int ag_y0;
164 int ag_y1;
165 int ag_height;
166 int ag_old_height;
167 int ag_old_fit_points;
168 int ag_shift_xpixels;
169 int ag_pf1;
170 int ag_pf2;
171 
172 float ag_first_fq;
173 float ag_hz_per_pixel;
174 
175 int afct_delay_points;
176 int old_afct_delay;
177 int afct_avgnum;
178 int afct_half_avgnum;
179 int max_afcf_points;
180 int max_afc_fit;
181 float afcf_search_range;
182 float afcf_max_drift;
183 float afc_minston;
184 int afc_speknum;
185 int afc_half_speknum;
186 int afc_ib;
187 int afc_ia;
188 float afc_drift_step;
189 int afc_graph_filled;
190 int afc_tpts;
191 
192 int mix1p0;
193 int ag_mask;
194 unsigned char afc_old_cursor_color;
195 int initial_afct_avgnum;
196 int ag_ss;
197 
198 
199 
200 float fftx_points_per_hz;
201 double hwfreq;
202 float mix1_selfreq[MAX_MIX1];
203 int mix1_curx[MAX_MIX1];
204 int new_mix1_curx[MAX_MIX1];
205 int mix1_point[MAX_MIX1];
206 float mix1_phase_step[MAX_MIX1];
207 float mix1_phase[MAX_MIX1];
208 float mix1_phase_rot[MAX_MIX1];
209 float mix1_old_phase[MAX_MIX1];
210 int mix1_old_point[MAX_MIX1];
211 int mix1_status[MAX_MIX1];
212 float mix1_good_freq[MAX_MIX1];
213 float afc_maxval;
214 float afc_noise;
215 float afc_noisefac;
216 float afc_fq;
217 unsigned char afc_cursor_color;
218 float afc_slope;
219 float ag_floatypix;
220 int ag_fpar_y0;
221 int ag_fpar_ytop;
222 int ag_ston_y;
223 int ag_lock_y;
224 int ag_srch_y;
225 int ag_ston_x1;
226 int ag_ston_x2;
227 int ag_lock_x1;
228 int ag_lock_x2;
229 int ag_srch_x1;
230 int ag_srch_x2;
231 
232 
233