| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  | /*  anf.h
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This file is part of a program that implements a Software-Defined Radio. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Copyright (C) 2012, 2013 Warren Pratt, NR0V | 
					
						
							|  |  |  | Copyright (C) 2024 Edouard Griffiths, F4EXB Adapted to SDRangel | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  | modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  | as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  | of the License, or (at your option) any later version. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  | GNU General Public License for more details. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  | along with this program; if not, write to the Free Software | 
					
						
							|  |  |  | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The author can be reached by email at | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | warren@wpratt.com | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef wdsp_anf_h
 | 
					
						
							|  |  |  | #define wdsp_anf_h
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-29 08:57:02 +02:00
										 |  |  | #include <array>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  | #include "export.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace WDSP { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class WDSP_API ANF | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     int run; | 
					
						
							|  |  |  |     int position; | 
					
						
							|  |  |  |     int buff_size; | 
					
						
							| 
									
										
										
										
											2024-06-25 03:50:48 +02:00
										 |  |  |     float *in_buff; | 
					
						
							|  |  |  |     float *out_buff; | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |     int dline_size; | 
					
						
							|  |  |  |     int mask; | 
					
						
							|  |  |  |     int n_taps; | 
					
						
							|  |  |  |     int delay; | 
					
						
							| 
									
										
										
										
											2024-07-18 02:08:05 +02:00
										 |  |  |     double two_mu; | 
					
						
							|  |  |  |     double gamma; | 
					
						
							| 
									
										
										
										
											2024-08-02 08:01:46 +02:00
										 |  |  |     static const int ANF_DLINE_SIZE = 2048; | 
					
						
							| 
									
										
										
										
											2024-07-29 08:57:02 +02:00
										 |  |  |     std::array<double, ANF_DLINE_SIZE> d; | 
					
						
							|  |  |  |     std::array<double, ANF_DLINE_SIZE> w; | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |     int in_idx; | 
					
						
							| 
									
										
										
										
											2024-07-18 02:08:05 +02:00
										 |  |  |     double lidx; | 
					
						
							|  |  |  |     double lidx_min; | 
					
						
							|  |  |  |     double lidx_max; | 
					
						
							|  |  |  |     double ngamma; | 
					
						
							|  |  |  |     double den_mult; | 
					
						
							|  |  |  |     double lincr; | 
					
						
							|  |  |  |     double ldecr; | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-29 08:57:02 +02:00
										 |  |  |     ANF( | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |         int run, | 
					
						
							|  |  |  |         int position, | 
					
						
							|  |  |  |         int buff_size, | 
					
						
							| 
									
										
										
										
											2024-06-25 03:50:48 +02:00
										 |  |  |         float *in_buff, | 
					
						
							|  |  |  |         float *out_buff, | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |         int dline_size, | 
					
						
							|  |  |  |         int n_taps, | 
					
						
							|  |  |  |         int delay, | 
					
						
							| 
									
										
										
										
											2024-07-18 02:08:05 +02:00
										 |  |  |         double two_mu, | 
					
						
							|  |  |  |         double gamma, | 
					
						
							|  |  |  |         double lidx, | 
					
						
							|  |  |  |         double lidx_min, | 
					
						
							|  |  |  |         double lidx_max, | 
					
						
							|  |  |  |         double ngamma, | 
					
						
							|  |  |  |         double den_mult, | 
					
						
							|  |  |  |         double lincr, | 
					
						
							|  |  |  |         double ldecr | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |     ); | 
					
						
							| 
									
										
										
										
											2024-07-29 08:57:02 +02:00
										 |  |  |     ANF(const ANF&) = delete; | 
					
						
							|  |  |  |     ANF& operator=(const ANF& other) = delete; | 
					
						
							|  |  |  |     ~ANF() = default; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void flush(); | 
					
						
							|  |  |  |     void execute(int position); | 
					
						
							|  |  |  |     void setBuffers(float* in, float* out); | 
					
						
							|  |  |  |     void setSamplerate(int rate); | 
					
						
							|  |  |  |     void setSize(int size); | 
					
						
							|  |  |  |     // Public Properties
 | 
					
						
							|  |  |  |     void setVals(int taps, int delay, double gain, double leakage); | 
					
						
							|  |  |  |     void setTaps(int taps); | 
					
						
							|  |  |  |     void setDelay(int delay); | 
					
						
							|  |  |  |     void setGain(double gain); | 
					
						
							|  |  |  |     void setLeakage(double leakage); | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace WDSP
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |