| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2023-11-19 06:43:20 +01:00
										 |  |  | // Copyright (C) 2016-2019 Edouard Griffiths, F4EXB <f4exb06@gmail.com>          //
 | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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 as version 3 of the License, or                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 14:32:15 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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 V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef SDRBASE_DSP_HBFILTERTRAITS_H_
 | 
					
						
							|  |  |  | #define SDRBASE_DSP_HBFILTERTRAITS_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <stdint.h>
 | 
					
						
							| 
									
										
										
										
											2018-03-20 13:49:21 +01:00
										 |  |  | #include "export.h"
 | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | // uses Q1.14 format internally, input and output are S16
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * supported filter orders: 96, 80, 64, 48, 32 | 
					
						
							|  |  |  |  * any usage of another value will be prevented by compilation errors | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | template<uint32_t HBFilterOrder> | 
					
						
							|  |  |  | struct HBFIRFilterTraits | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 23:25:20 +01:00
										 |  |  | template<> | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | struct SDRBASE_API HBFIRFilterTraits<16> | 
					
						
							| 
									
										
										
										
											2017-01-03 23:25:20 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     static const int32_t hbOrder = 16; | 
					
						
							| 
									
										
										
										
											2018-01-18 00:21:50 +01:00
										 |  |  |     static const int32_t hbShift = 12; | 
					
						
							| 
									
										
										
										
											2017-01-03 23:25:20 +01:00
										 |  |  |     static const int16_t hbMod[16+6]; | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #ifdef _MSC_VER
 | 
					
						
							|  |  |  |     __declspec(align(16)) static const int32_t hbCoeffs[4]; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2017-01-03 23:25:20 +01:00
										 |  |  |     static const int32_t hbCoeffs[4] __attribute__ ((aligned (16))); | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-02-02 02:12:49 +01:00
										 |  |  |     static const double  hbCoeffsF[4]; | 
					
						
							| 
									
										
										
										
											2017-01-03 23:25:20 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | template<> | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | struct SDRBASE_API HBFIRFilterTraits<32> | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     static const int32_t hbOrder = 32; | 
					
						
							| 
									
										
										
										
											2018-01-18 00:21:50 +01:00
										 |  |  |     static const int32_t hbShift = 12; | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  |     static const int16_t hbMod[32+6]; | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #ifdef _MSC_VER
 | 
					
						
							|  |  |  |     __declspec(align(32)) static const int32_t hbCoeffs[8]; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2016-11-07 04:16:02 +01:00
										 |  |  |     static const int32_t hbCoeffs[8] __attribute__ ((aligned (32))); | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-02-02 02:12:49 +01:00
										 |  |  |     static const double  hbCoeffsF[8]; | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<> | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | struct SDRBASE_API HBFIRFilterTraits<48> | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     static const int32_t hbOrder = 48; | 
					
						
							| 
									
										
										
										
											2018-01-18 00:21:50 +01:00
										 |  |  |     static const int32_t hbShift = 12; | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  |     static const int16_t hbMod[48+6]; | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #ifdef _MSC_VER
 | 
					
						
							|  |  |  |     __declspec(align(16)) static const int32_t hbCoeffs[12]; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  |     static const int32_t hbCoeffs[12] __attribute__ ((aligned (16))); | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-02-02 02:12:49 +01:00
										 |  |  |     static const double  hbCoeffsF[12]; | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<> | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | struct SDRBASE_API HBFIRFilterTraits<64> | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     static const int32_t hbOrder = 64; | 
					
						
							| 
									
										
										
										
											2018-01-18 00:21:50 +01:00
										 |  |  |     static const int32_t hbShift = 12; | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  |     static const int16_t hbMod[64+6]; | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #ifdef _MSC_VER
 | 
					
						
							|  |  |  |     __declspec(align(32)) static const int32_t hbCoeffs[16]; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2016-11-07 04:16:02 +01:00
										 |  |  |     static const int32_t hbCoeffs[16] __attribute__ ((aligned (32))); | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-05-01 19:49:47 +02:00
										 |  |  |     static const float  hbCoeffsF[16]; | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<> | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | struct SDRBASE_API HBFIRFilterTraits<80> | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     static const int32_t hbOrder = 80; | 
					
						
							|  |  |  |     static const int32_t hbShift = 14; | 
					
						
							|  |  |  |     static const int16_t hbMod[80+6]; | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #ifdef _MSC_VER
 | 
					
						
							|  |  |  |     __declspec(align(16)) static const int32_t hbCoeffs[20]; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  |     static const int32_t hbCoeffs[20] __attribute__ ((aligned (16))); | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-02-02 02:12:49 +01:00
										 |  |  |     static const double  hbCoeffsF[20]; | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<> | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | struct SDRBASE_API HBFIRFilterTraits<96> | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     static const int32_t hbOrder = 96; | 
					
						
							|  |  |  |     static const int32_t hbShift = 16; | 
					
						
							|  |  |  |     static const int16_t hbMod[96+6]; | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #ifdef _MSC_VER
 | 
					
						
							|  |  |  |     __declspec(align(32)) static const int32_t hbCoeffs[24]; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2016-11-07 04:16:02 +01:00
										 |  |  |     static const int32_t hbCoeffs[24] __attribute__ ((aligned (32))); | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-02-02 02:12:49 +01:00
										 |  |  |     static const double  hbCoeffsF[24]; | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<> | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | struct SDRBASE_API HBFIRFilterTraits<112> | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     static const int32_t hbOrder = 112; | 
					
						
							| 
									
										
										
										
											2018-01-18 00:21:50 +01:00
										 |  |  |     static const int32_t hbShift = 18; | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  |     static const int16_t hbMod[112+6]; | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #ifdef _MSC_VER
 | 
					
						
							|  |  |  |     __declspec(align(16)) static const int32_t hbCoeffs[28]; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  |     static const int32_t hbCoeffs[28] __attribute__ ((aligned (16))); | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-02-02 02:12:49 +01:00
										 |  |  |     static const double  hbCoeffsF[28]; | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<> | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | struct SDRBASE_API HBFIRFilterTraits<128> | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     static const int32_t hbOrder = 128; | 
					
						
							| 
									
										
										
										
											2018-01-18 00:21:50 +01:00
										 |  |  |     static const int32_t hbShift = 20; | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  |     static const int16_t hbMod[128+6]; | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #ifdef _MSC_VER
 | 
					
						
							|  |  |  |     __declspec(align(16)) static const int32_t hbCoeffs[32]; | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2016-11-04 01:12:39 +01:00
										 |  |  |     static const int32_t hbCoeffs[32] __attribute__ ((aligned (16))); | 
					
						
							| 
									
										
										
										
											2018-11-12 14:04:16 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-02-02 02:12:49 +01:00
										 |  |  |     static const double  hbCoeffsF[32]; | 
					
						
							| 
									
										
										
										
											2016-11-01 11:55:16 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* SDRBASE_DSP_HBFILTERTRAITS_H_ */
 |