| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2018 Edouard Griffiths, F4EXB                                   //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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.                                           //
 | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02: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/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "decimatorsff.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<true>::decimate1(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     float xreal, yimag; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int pos = 0; pos < nbIAndQ - 1; pos += 2) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         xreal = buf[pos+0]; | 
					
						
							|  |  |  |         yimag = buf[pos+1]; | 
					
						
							|  |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							|  |  |  |         ++(*it); // Valgrind optim (comment not repeated)
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<false>::decimate1(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |     float xreal, yimag; | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |     for (int pos = 0; pos < nbIAndQ - 1; pos += 2) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = buf[pos+1]; | 
					
						
							|  |  |  |         yimag = buf[pos+0]; | 
					
						
							|  |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							|  |  |  |         ++(*it); // Valgrind optim (comment not repeated)
 | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<true>::decimate2_inf(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 11:08:08 +02:00
										 |  |  |     float xreal, yimag; | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     for (int pos = 0; pos < nbIAndQ - 7; pos += 8) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         xreal = (buf[pos+0] - buf[pos+3]); | 
					
						
							|  |  |  |         yimag = (buf[pos+1] + buf[pos+2]); | 
					
						
							|  |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							|  |  |  |         ++(*it); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         xreal = (buf[pos+7] - buf[pos+4]); | 
					
						
							|  |  |  |         yimag = (- buf[pos+5] - buf[pos+6]); | 
					
						
							|  |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							|  |  |  |         ++(*it); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<false>::decimate2_inf(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 11:08:08 +02:00
										 |  |  |     float xreal, yimag; | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     for (int pos = 0; pos < nbIAndQ - 7; pos += 8) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (buf[pos+1] + buf[pos+2]); | 
					
						
							|  |  |  |         yimag = (buf[pos+0] - buf[pos+3]); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							|  |  |  |         ++(*it); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (- buf[pos+5] - buf[pos+6]); | 
					
						
							|  |  |  |         yimag = (buf[pos+7] - buf[pos+4]); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							|  |  |  |         ++(*it); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<true>::decimate2_sup(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 11:08:08 +02:00
										 |  |  |     float xreal, yimag; | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     for (int pos = 0; pos < nbIAndQ - 7; pos += 8) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (buf[pos+1] - buf[pos+2]); | 
					
						
							|  |  |  |         yimag = (- buf[pos+0] - buf[pos+3]); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         ++(*it); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (buf[pos+6] - buf[pos+5]); | 
					
						
							|  |  |  |         yimag = (buf[pos+4] + buf[pos+7]); | 
					
						
							|  |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |         ++(*it); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<false>::decimate2_sup(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 11:08:08 +02:00
										 |  |  |     float xreal, yimag; | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     for (int pos = 0; pos < nbIAndQ - 7; pos += 8) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (- buf[pos+0] - buf[pos+3]); | 
					
						
							|  |  |  |         yimag = (buf[pos+1] - buf[pos+2]); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							|  |  |  |         ++(*it); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (buf[pos+4] + buf[pos+7]); | 
					
						
							|  |  |  |         yimag = (buf[pos+6] - buf[pos+5]); | 
					
						
							|  |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |         ++(*it); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<true>::decimate4_inf(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |     float xreal, yimag; | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     for (int pos = 0; pos < nbIAndQ - 7; pos += 8) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]); | 
					
						
							|  |  |  |         yimag = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         ++(*it); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<false>::decimate4_inf(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |     float xreal, yimag; | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |     for (int pos = 0; pos < nbIAndQ - 7; pos += 8) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]); | 
					
						
							|  |  |  |         yimag = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         ++(*it); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<true>::decimate4_sup(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |     // Sup (USB):
 | 
					
						
							|  |  |  |     //            x  y   x  y   x   y  x   y  / x -> 1,-2,-5,6 / y -> -0,-3,4,7
 | 
					
						
							|  |  |  |     // [ rotate:  1, 0, -2, 3, -5, -4, 6, -7]
 | 
					
						
							|  |  |  |     // Inf (LSB):
 | 
					
						
							|  |  |  |     //            x  y   x  y   x   y  x   y  / x -> 0,-3,-4,7 / y -> 1,2,-5,-6
 | 
					
						
							|  |  |  |     // [ rotate:  0, 1, -3, 2, -4, -5, 7, -6]
 | 
					
						
							|  |  |  |     float xreal, yimag; | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |     for (int pos = 0; pos < nbIAndQ - 7; pos += 8) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]); | 
					
						
							|  |  |  |         yimag = (- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         ++(*it); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | void DecimatorsFF<false>::decimate4_sup(FSampleVector::iterator* it, const float* buf, qint32 nbIAndQ) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |     // Sup (USB):
 | 
					
						
							|  |  |  |     //            x  y   x  y   x   y  x   y  / x -> 1,-2,-5,6 / y -> -0,-3,4,7
 | 
					
						
							|  |  |  |     // [ rotate:  1, 0, -2, 3, -5, -4, 6, -7]
 | 
					
						
							|  |  |  |     // Inf (LSB):
 | 
					
						
							|  |  |  |     //            x  y   x  y   x   y  x   y  / x -> 0,-3,-4,7 / y -> 1,2,-5,-6
 | 
					
						
							|  |  |  |     // [ rotate:  0, 1, -3, 2, -4, -5, 7, -6]
 | 
					
						
							|  |  |  |     float xreal, yimag; | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |     for (int pos = 0; pos < nbIAndQ - 7; pos += 8) | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         xreal = (- buf[pos+0] - buf[pos+3] + buf[pos+4] + buf[pos+7]); | 
					
						
							|  |  |  |         yimag = (buf[pos+1] - buf[pos+2] - buf[pos+5] + buf[pos+6]); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-21 11:46:08 +02:00
										 |  |  |         (**it).setReal(xreal); | 
					
						
							|  |  |  |         (**it).setImag(yimag); | 
					
						
							| 
									
										
										
										
											2018-04-25 18:01:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         ++(*it); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |