mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04:00 
			
		
		
		
	HackRF output: implementation of Fc position selection in the GUI
This commit is contained in:
		
							parent
							
								
									ca24d8e9f6
								
							
						
					
					
						commit
						8e6f9d8d24
					
				| @ -335,6 +335,7 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc | ||||
|         << " m_bandwidth: " << settings.m_bandwidth | ||||
|         << " m_devSampleRate: " << settings.m_devSampleRate | ||||
|         << " m_log2Interp: " << settings.m_log2Interp | ||||
|         << " m_fcPos: " << settings.m_fcPos | ||||
|         << " m_biasT: " << settings.m_biasT | ||||
|         << " m_lnaExt: " << settings.m_lnaExt | ||||
|         << " m_vgaGain: " << settings.m_vgaGain | ||||
| @ -434,6 +435,13 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc | ||||
| 		forwardChange = true; | ||||
| 	} | ||||
| 
 | ||||
| 	if ((m_settings.m_fcPos != settings.m_fcPos) || force) | ||||
| 	{ | ||||
| 		if (m_hackRFThread != 0) { | ||||
| 			m_hackRFThread->setFcPos((int) settings.m_fcPos); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	if ((m_settings.m_vgaGain != settings.m_vgaGain) || force) | ||||
| 	{ | ||||
|         reverseAPIKeys.append("vgaGain"); | ||||
|  | ||||
| @ -298,6 +298,12 @@ void HackRFOutputGui::on_interp_currentIndexChanged(int index) | ||||
| 	sendSettings(); | ||||
| } | ||||
| 
 | ||||
| void HackRFOutputGui::on_fcPos_currentIndexChanged(int index) | ||||
| { | ||||
|     m_settings.m_fcPos = (HackRFOutputSettings::fcPos_t) (index < 0 ? 0 : index > 2 ? 2 : index); | ||||
| 	sendSettings(); | ||||
| } | ||||
| 
 | ||||
| void HackRFOutputGui::on_txvga_valueChanged(int value) | ||||
| { | ||||
| 	if ((value < 0) || (value > 47)) | ||||
|  | ||||
| @ -89,6 +89,7 @@ private slots: | ||||
| 	void on_LOppm_valueChanged(int value); | ||||
| 	void on_biasT_stateChanged(int state); | ||||
| 	void on_interp_currentIndexChanged(int index); | ||||
| 	void on_fcPos_currentIndexChanged(int index); | ||||
| 	void on_lnaExt_stateChanged(int state); | ||||
| 	void on_bbFilter_currentIndexChanged(int index); | ||||
| 	void on_txvga_valueChanged(int value); | ||||
|  | ||||
| @ -349,6 +349,41 @@ | ||||
|        </property> | ||||
|       </spacer> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="QLabel" name="fcPosLabel"> | ||||
|        <property name="text"> | ||||
|         <string>Fc</string> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="QComboBox" name="fcPos"> | ||||
|        <property name="maximumSize"> | ||||
|         <size> | ||||
|          <width>50</width> | ||||
|          <height>16777215</height> | ||||
|         </size> | ||||
|        </property> | ||||
|        <property name="toolTip"> | ||||
|         <string>Relative position of device center frequency</string> | ||||
|        </property> | ||||
|        <item> | ||||
|         <property name="text"> | ||||
|          <string>Inf</string> | ||||
|         </property> | ||||
|        </item> | ||||
|        <item> | ||||
|         <property name="text"> | ||||
|          <string>Sup</string> | ||||
|         </property> | ||||
|        </item> | ||||
|        <item> | ||||
|         <property name="text"> | ||||
|          <string>Cen</string> | ||||
|         </property> | ||||
|        </item> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="QLabel" name="label_interp"> | ||||
|        <property name="text"> | ||||
|  | ||||
| @ -31,6 +31,7 @@ void HackRFOutputSettings::resetToDefaults() | ||||
| 	m_LOppmTenths = 0; | ||||
| 	m_biasT = false; | ||||
| 	m_log2Interp = 0; | ||||
|     m_fcPos = FC_POS_CENTER; | ||||
| 	m_lnaExt = false; | ||||
| 	m_vgaGain = 22; | ||||
| 	m_bandwidth = 1750000; | ||||
| @ -46,6 +47,7 @@ QByteArray HackRFOutputSettings::serialize() const | ||||
| 	SimpleSerializer s(1); | ||||
| 
 | ||||
| 	s.writeS32(1, m_LOppmTenths); | ||||
|     s.writeS32(2, (int) m_fcPos); | ||||
| 	s.writeBool(3, m_biasT); | ||||
| 	s.writeU32(4, m_log2Interp); | ||||
| 	s.writeBool(5, m_lnaExt); | ||||
| @ -73,8 +75,11 @@ bool HackRFOutputSettings::deserialize(const QByteArray& data) | ||||
| 	if (d.getVersion() == 1) | ||||
| 	{ | ||||
| 		uint32_t uintval; | ||||
|         int32_t intval; | ||||
| 
 | ||||
| 		d.readS32(1, &m_LOppmTenths, 0); | ||||
|         d.readS32(2, &intval, 2); | ||||
|         m_fcPos = (fcPos_t) (intval < 0 ? 0 : intval > 2 ? 2 : intval); | ||||
| 		d.readBool(3, &m_biasT, false); | ||||
| 		d.readU32(4, &m_log2Interp, 0); | ||||
| 		d.readBool(5, &m_lnaExt, false); | ||||
|  | ||||
| @ -21,11 +21,18 @@ | ||||
| #include <QString> | ||||
| 
 | ||||
| struct HackRFOutputSettings { | ||||
| 	typedef enum { | ||||
| 		FC_POS_INFRA = 0, | ||||
| 		FC_POS_SUPRA, | ||||
| 		FC_POS_CENTER | ||||
| 	} fcPos_t; | ||||
| 
 | ||||
| 	quint64 m_centerFrequency; | ||||
| 	qint32  m_LOppmTenths; | ||||
| 	quint32 m_bandwidth; | ||||
| 	quint32 m_vgaGain; | ||||
| 	quint32 m_log2Interp; | ||||
|   	fcPos_t m_fcPos; | ||||
| 	quint64 m_devSampleRate; | ||||
| 	bool m_biasT; | ||||
| 	bool m_lnaExt; | ||||
|  | ||||
| @ -58,6 +58,11 @@ void HackRFOutputThread::setLog2Interpolation(unsigned int log2Interp) | ||||
| 	m_log2Interp = log2Interp; | ||||
| } | ||||
| 
 | ||||
| void HackRFOutputThread::setFcPos(int fcPos) | ||||
| { | ||||
| 	m_fcPos = fcPos; | ||||
| } | ||||
| 
 | ||||
| void HackRFOutputThread::run() | ||||
| { | ||||
| 	hackrf_error rc; | ||||
| @ -121,28 +126,83 @@ void HackRFOutputThread::callback(qint8* buf, qint32 len) | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
|         switch (m_log2Interp) | ||||
| 		if (m_fcPos == 0) // Infra
 | ||||
| 		{ | ||||
|             switch (m_log2Interp) | ||||
|             { | ||||
|             case 1: | ||||
|                 m_interpolators.interpolate2_inf(&beginRead, buf, len); | ||||
|                 break; | ||||
|             case 2: | ||||
|                 m_interpolators.interpolate4_inf(&beginRead, buf, len); | ||||
|                 break; | ||||
|             // case 3:
 | ||||
|             //     m_interpolators.interpolate8_cen(&beginRead, buf, len);
 | ||||
|             //     break;
 | ||||
|             // case 4:
 | ||||
|             //     m_interpolators.interpolate16_cen(&beginRead, buf, len);
 | ||||
|             //     break;
 | ||||
|             // case 5:
 | ||||
|             //     m_interpolators.interpolate32_cen(&beginRead, buf, len);
 | ||||
|             //     break;
 | ||||
|             // case 6:
 | ||||
|             //     m_interpolators.interpolate64_cen(&beginRead, buf, len);
 | ||||
|             //     break;
 | ||||
|             default: | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         else if (m_fcPos == 1) // Supra
 | ||||
|         { | ||||
|         case 1: | ||||
|             m_interpolators.interpolate2_cen(&beginRead, buf, len); | ||||
|             break; | ||||
|         case 2: | ||||
|             m_interpolators.interpolate4_cen(&beginRead, buf, len); | ||||
|             break; | ||||
|         case 3: | ||||
|             m_interpolators.interpolate8_cen(&beginRead, buf, len); | ||||
|             break; | ||||
|         case 4: | ||||
|             m_interpolators.interpolate16_cen(&beginRead, buf, len); | ||||
|             break; | ||||
|         case 5: | ||||
|             m_interpolators.interpolate32_cen(&beginRead, buf, len); | ||||
|             break; | ||||
|         case 6: | ||||
|             m_interpolators.interpolate64_cen(&beginRead, buf, len); | ||||
|             break; | ||||
|         default: | ||||
|             break; | ||||
|             switch (m_log2Interp) | ||||
|             { | ||||
|             case 1: | ||||
|                 m_interpolators.interpolate2_sup(&beginRead, buf, len); | ||||
|                 break; | ||||
|             case 2: | ||||
|                 m_interpolators.interpolate4_sup(&beginRead, buf, len); | ||||
|                 break; | ||||
|             // case 3:
 | ||||
|             //     m_interpolators.interpolate8_cen(&beginRead, buf, len);
 | ||||
|             //     break;
 | ||||
|             // case 4:
 | ||||
|             //     m_interpolators.interpolate16_cen(&beginRead, buf, len);
 | ||||
|             //     break;
 | ||||
|             // case 5:
 | ||||
|             //     m_interpolators.interpolate32_cen(&beginRead, buf, len);
 | ||||
|             //     break;
 | ||||
|             // case 6:
 | ||||
|             //     m_interpolators.interpolate64_cen(&beginRead, buf, len);
 | ||||
|             //     break;
 | ||||
|             default: | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         else if (m_fcPos == 2) // Center
 | ||||
|         { | ||||
|             switch (m_log2Interp) | ||||
|             { | ||||
|             case 1: | ||||
|                 m_interpolators.interpolate2_cen(&beginRead, buf, len); | ||||
|                 break; | ||||
|             case 2: | ||||
|                 m_interpolators.interpolate4_cen(&beginRead, buf, len); | ||||
|                 break; | ||||
|             case 3: | ||||
|                 m_interpolators.interpolate8_cen(&beginRead, buf, len); | ||||
|                 break; | ||||
|             case 4: | ||||
|                 m_interpolators.interpolate16_cen(&beginRead, buf, len); | ||||
|                 break; | ||||
|             case 5: | ||||
|                 m_interpolators.interpolate32_cen(&beginRead, buf, len); | ||||
|                 break; | ||||
|             case 6: | ||||
|                 m_interpolators.interpolate64_cen(&beginRead, buf, len); | ||||
|                 break; | ||||
|             default: | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -37,6 +37,7 @@ public: | ||||
| 	void startWork(); | ||||
| 	void stopWork(); | ||||
| 	void setLog2Interpolation(unsigned int log2_interp); | ||||
|     void setFcPos(int fcPos); | ||||
| 
 | ||||
| private: | ||||
| 	QMutex m_startWaitMutex; | ||||
| @ -48,6 +49,7 @@ private: | ||||
| 	SampleSourceFifo* m_sampleFifo; | ||||
| 
 | ||||
| 	unsigned int m_log2Interp; | ||||
|     int m_fcPos; | ||||
| 
 | ||||
|     Interpolators<qint8, SDR_TX_SAMP_SZ, 8> m_interpolators; | ||||
| 
 | ||||
|  | ||||
| @ -106,11 +106,16 @@ class Interpolators | ||||
| public: | ||||
|     // interleaved I/Q input buffer
 | ||||
| 	void interpolate1(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate2_cen(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 
 | ||||
|     void interpolate2_cen(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate2_inf(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate2_sup(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate4_cen(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate8_cen(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 
 | ||||
|     void interpolate4_cen(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate4_inf(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate4_sup(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 
 | ||||
|     void interpolate8_cen(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate16_cen(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate32_cen(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| 	void interpolate64_cen(SampleVector::iterator* it, T* buf, qint32 len); | ||||
| @ -174,23 +179,25 @@ void Interpolators<T, SdrBits, OutputBits>::interpolate2_inf(SampleVector::itera | ||||
| 
 | ||||
|     for (int pos = 0; pos < len - 7; pos += 8) | ||||
|     { | ||||
|         memset(intbuf, 0, 8*sizeof(qint32)); | ||||
| 
 | ||||
|         intbuf[0] = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre2; | ||||
|         intbuf[1] = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre2; | ||||
|         m_interpolator2.myInterpolate(&intbuf[0], &intbuf[1], &intbuf[2], &intbuf[3]); | ||||
|         ++(*it); | ||||
|         intbuf[4] = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre2; | ||||
|         intbuf[5] = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre2; | ||||
|         m_interpolator2.myInterpolate(&intbuf[4], &intbuf[5], &intbuf[6], &intbuf[7]); | ||||
|         ++(*it); | ||||
| 
 | ||||
|         buf[pos+0] =   intbuf[1] >> interpolation_shifts<SdrBits, OutputBits>::post2;  // + imag
 | ||||
|         buf[pos+1] = -(intbuf[0] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - real
 | ||||
|         buf[pos+2] = -(intbuf[2] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - real
 | ||||
|         buf[pos+3] = -(intbuf[3] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - imag
 | ||||
|         buf[pos+4] = -(intbuf[5] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - imag
 | ||||
|         buf[pos+5] =   intbuf[4] >> interpolation_shifts<SdrBits, OutputBits>::post2;  // + real
 | ||||
|         buf[pos+6] =   intbuf[6] >> interpolation_shifts<SdrBits, OutputBits>::post2;  // + real
 | ||||
|         buf[pos+7] =   intbuf[7] >> interpolation_shifts<SdrBits, OutputBits>::post2;  // + imag
 | ||||
|         m_interpolator2.myInterpolateInf(&intbuf[0], &intbuf[1], &intbuf[2], &intbuf[3], &intbuf[4], &intbuf[5], &intbuf[6], &intbuf[7]); | ||||
| 
 | ||||
|         buf[pos+0] = intbuf[0] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+1] = intbuf[1] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+2] = intbuf[2] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+3] = intbuf[3] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+4] = intbuf[4] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+5] = intbuf[5] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+6] = intbuf[6] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+7] = intbuf[7] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -201,23 +208,25 @@ void Interpolators<T, SdrBits, OutputBits>::interpolate2_sup(SampleVector::itera | ||||
| 
 | ||||
|     for (int pos = 0; pos < len - 7; pos += 8) | ||||
|     { | ||||
|         memset(intbuf, 0, 8*sizeof(qint32)); | ||||
| 
 | ||||
|         intbuf[0] = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre2; | ||||
|         intbuf[1] = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre2; | ||||
|         m_interpolator2.myInterpolate(&intbuf[0], &intbuf[1], &intbuf[2], &intbuf[3]); | ||||
|         ++(*it); | ||||
|         intbuf[4] = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre2; | ||||
|         intbuf[5] = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre2; | ||||
|         m_interpolator2.myInterpolate(&intbuf[4], &intbuf[5], &intbuf[6], &intbuf[7]); | ||||
|         ++(*it); | ||||
| 
 | ||||
|         buf[pos+0] = -(intbuf[1] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - imag
 | ||||
|         buf[pos+1] =   intbuf[0] >> interpolation_shifts<SdrBits, OutputBits>::post2;  // + real
 | ||||
|         buf[pos+2] = -(intbuf[2] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - real
 | ||||
|         buf[pos+3] = -(intbuf[3] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - imag
 | ||||
|         buf[pos+4] =   intbuf[5] >> interpolation_shifts<SdrBits, OutputBits>::post2;  // + imag
 | ||||
|         buf[pos+5] = -(intbuf[4] >> interpolation_shifts<SdrBits, OutputBits>::post2); // - real
 | ||||
|         buf[pos+6] =   intbuf[6] >> interpolation_shifts<SdrBits, OutputBits>::post2;  // + real
 | ||||
|         buf[pos+7] =   intbuf[7] >> interpolation_shifts<SdrBits, OutputBits>::post2;  // + imag
 | ||||
|         m_interpolator2.myInterpolateSup(&intbuf[0], &intbuf[1], &intbuf[2], &intbuf[3], &intbuf[4], &intbuf[5], &intbuf[6], &intbuf[7]); | ||||
| 
 | ||||
|         buf[pos+0] = intbuf[0] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+1] = intbuf[1] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+2] = intbuf[2] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+3] = intbuf[3] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+4] = intbuf[4] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+5] = intbuf[5] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+6] = intbuf[6] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|         buf[pos+7] = intbuf[7] >> interpolation_shifts<SdrBits, OutputBits>::post2; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| @ -250,6 +259,86 @@ void Interpolators<T, SdrBits, OutputBits>::interpolate4_cen(SampleVector::itera | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| template<typename T, uint SdrBits, uint OutputBits> | ||||
| void Interpolators<T, SdrBits, OutputBits>::interpolate4_inf(SampleVector::iterator* it, T* buf, qint32 len) | ||||
| { | ||||
|     qint32 intbuf[16]; | ||||
| 
 | ||||
|     for (int pos = 0; pos < len - 15; pos += 16) | ||||
|     { | ||||
|         memset(intbuf, 0, 16*sizeof(qint32)); | ||||
| 		intbuf[0]  = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre4; | ||||
| 		intbuf[1]  = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre4; | ||||
|         ++(*it); | ||||
| 		intbuf[8]  = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre4; | ||||
| 		intbuf[9]  = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre4; | ||||
|         ++(*it); | ||||
| 
 | ||||
|         m_interpolator2.myInterpolateInf(&intbuf[0], &intbuf[1], &intbuf[4], &intbuf[5], &intbuf[8], &intbuf[9], &intbuf[12], &intbuf[13]); | ||||
| 
 | ||||
|         m_interpolator4.myInterpolateInf(&intbuf[0], &intbuf[1], &intbuf[2], &intbuf[3], &intbuf[4], &intbuf[5], &intbuf[6], &intbuf[7]); | ||||
|         m_interpolator4.myInterpolateInf(&intbuf[8], &intbuf[9], &intbuf[10], &intbuf[11], &intbuf[12], &intbuf[13], &intbuf[14], &intbuf[15]); | ||||
| 
 | ||||
|         buf[pos+0] = intbuf[0] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+1] = intbuf[1] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+2] = intbuf[2] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+3] = intbuf[3] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+4] = intbuf[4] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+5] = intbuf[5] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+6] = intbuf[6] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+7] = intbuf[7] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
| 
 | ||||
|         buf[pos+8]  = intbuf[8]  >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+9]  = intbuf[9]  >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+10] = intbuf[10] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+11] = intbuf[11] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+12] = intbuf[12] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+13] = intbuf[13] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+14] = intbuf[14] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+15] = intbuf[15] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| template<typename T, uint SdrBits, uint OutputBits> | ||||
| void Interpolators<T, SdrBits, OutputBits>::interpolate4_sup(SampleVector::iterator* it, T* buf, qint32 len) | ||||
| { | ||||
|     qint32 intbuf[16]; | ||||
| 
 | ||||
|     for (int pos = 0; pos < len - 15; pos += 16) | ||||
|     { | ||||
|         memset(intbuf, 0, 16*sizeof(qint32)); | ||||
| 		intbuf[0]  = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre4; | ||||
| 		intbuf[1]  = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre4; | ||||
|         ++(*it); | ||||
| 		intbuf[8]  = (**it).m_real << interpolation_shifts<SdrBits, OutputBits>::pre4; | ||||
| 		intbuf[9]  = (**it).m_imag << interpolation_shifts<SdrBits, OutputBits>::pre4; | ||||
|         ++(*it); | ||||
| 
 | ||||
|         m_interpolator2.myInterpolateSup(&intbuf[0], &intbuf[1], &intbuf[4], &intbuf[5], &intbuf[8], &intbuf[9], &intbuf[12], &intbuf[13]); | ||||
| 
 | ||||
|         m_interpolator4.myInterpolateSup(&intbuf[0], &intbuf[1], &intbuf[2], &intbuf[3], &intbuf[4], &intbuf[5], &intbuf[6], &intbuf[7]); | ||||
|         m_interpolator4.myInterpolateSup(&intbuf[8], &intbuf[9], &intbuf[10], &intbuf[11], &intbuf[12], &intbuf[13], &intbuf[14], &intbuf[15]); | ||||
| 
 | ||||
|         buf[pos+0] = intbuf[0] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+1] = intbuf[1] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+2] = intbuf[2] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+3] = intbuf[3] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+4] = intbuf[4] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+5] = intbuf[5] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+6] = intbuf[6] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+7] = intbuf[7] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
| 
 | ||||
|         buf[pos+8]  = intbuf[8]  >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+9]  = intbuf[9]  >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+10] = intbuf[10] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+11] = intbuf[11] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+12] = intbuf[12] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+13] = intbuf[13] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+14] = intbuf[14] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|         buf[pos+15] = intbuf[15] >> interpolation_shifts<SdrBits, OutputBits>::post4; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| template<typename T, uint SdrBits, uint OutputBits> | ||||
| void Interpolators<T, SdrBits, OutputBits>::interpolate8_cen(SampleVector::iterator* it, T* buf, qint32 len) | ||||
| { | ||||
|  | ||||
| @ -747,6 +747,38 @@ public: | ||||
|         doInterpolateFIR(x2, y2); | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateInf(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = *y1; | ||||
|         *y1 = -x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = -*y3; | ||||
|         *y3 = x; | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateSup(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = -*y1; | ||||
|         *y1 = x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = *y3; | ||||
|         *y3 = -x; | ||||
|     } | ||||
| 
 | ||||
| protected: | ||||
| 	AccuType m_samples[HBFIRFilterTraits<HBFilterOrder>::hbOrder + 1][2];     // Valgrind optim (from qint16)
 | ||||
| 	qint16 m_ptr; | ||||
|  | ||||
| @ -629,6 +629,38 @@ public: | ||||
|         doInterpolateFIR(x2, y2); | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateInf(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = *y1; | ||||
|         *y1 = -x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = -*y3; | ||||
|         *y3 = x; | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateSup(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = -*y1; | ||||
|         *y1 = x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = *y3; | ||||
|         *y3 = -x; | ||||
|     } | ||||
| 
 | ||||
| protected: | ||||
| 	AccuType m_samplesDB[2*(HBFIRFilterTraits<HBFilterOrder>::hbOrder - 1)][2]; // double buffer technique
 | ||||
| 	int m_ptr; | ||||
|  | ||||
| @ -65,6 +65,38 @@ public: | ||||
|         doInterpolateFIR(x2, y2); | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateInf(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = *y1; | ||||
|         *y1 = -x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = -*y3; | ||||
|         *y3 = x; | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateSup(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = -*y1; | ||||
|         *y1 = x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = *y3; | ||||
|         *y3 = -x; | ||||
|     } | ||||
| 
 | ||||
| protected: | ||||
|     SampleType m_samplesDB[2*(HBFIRFilterTraits<HBFilterOrder>::hbOrder - 1)][2]; // double buffer technique
 | ||||
| 	int m_ptr; | ||||
|  | ||||
| @ -579,6 +579,38 @@ public: | ||||
|         doInterpolateFIR(x2, y2); | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateInf(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = *y1; | ||||
|         *y1 = -x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = -*y3; | ||||
|         *y3 = x; | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateSup(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = -*y1; | ||||
|         *y1 = x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = *y3; | ||||
|         *y3 = -x; | ||||
|     } | ||||
| 
 | ||||
| protected: | ||||
|     SampleType m_samplesDB[2*(HBFIRFilterTraits<HBFilterOrder>::hbOrder - 1)][2]; // double buffer technique
 | ||||
| 	int m_ptr; | ||||
|  | ||||
| @ -579,6 +579,38 @@ public: | ||||
|         doInterpolateFIR(x2, y2); | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateInf(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = *y1; | ||||
|         *y1 = -x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = -*y3; | ||||
|         *y3 = x; | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateSup(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = -*y1; | ||||
|         *y1 = x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = *y3; | ||||
|         *y3 = -x; | ||||
|     } | ||||
| 
 | ||||
| protected: | ||||
|     SampleType m_samplesDB[2*(HBFIRFilterTraits<HBFilterOrder>::hbOrder - 1)][2]; // double buffer technique
 | ||||
| 	int m_ptr; | ||||
|  | ||||
| @ -754,6 +754,38 @@ public: | ||||
|         doInterpolateFIR(x2, y2); | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateInf(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = *y1; | ||||
|         *y1 = -x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = -*y3; | ||||
|         *y3 = x; | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateSup(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = -*y1; | ||||
|         *y1 = x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = *y3; | ||||
|         *y3 = -x; | ||||
|     } | ||||
| 
 | ||||
| protected: | ||||
|     EOStorageType m_even[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder]; | ||||
|     EOStorageType m_odd[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder]; | ||||
|  | ||||
| @ -620,6 +620,38 @@ public: | ||||
|         doInterpolateFIR(x2, y2); | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateInf(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = *y1; | ||||
|         *y1 = -x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = -*y3; | ||||
|         *y3 = x; | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateSup(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = -*y1; | ||||
|         *y1 = x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = *y3; | ||||
|         *y3 = -x; | ||||
|     } | ||||
| 
 | ||||
| protected: | ||||
|     int32_t m_even[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder]; // double buffer technique
 | ||||
|     int32_t m_odd[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder]; // double buffer technique
 | ||||
|  | ||||
| @ -620,6 +620,38 @@ public: | ||||
|         doInterpolateFIR(x2, y2); | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateInf(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = *y1; | ||||
|         *y1 = -x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = -*y3; | ||||
|         *y3 = x; | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateSup(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = -*y1; | ||||
|         *y1 = x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = *y3; | ||||
|         *y3 = -x; | ||||
|     } | ||||
| 
 | ||||
| protected: | ||||
|     qint64 m_even[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder];     // double buffer technique
 | ||||
|     qint64 m_odd[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder];      // double buffer technique
 | ||||
|  | ||||
| @ -106,6 +106,38 @@ public: | ||||
|         doInterpolateFIR(x2, y2); | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateInf(float *x1, float *y1, float *x2, float *y2, float *x3, float *y3, float *x4, float *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = *y1; | ||||
|         *y1 = -x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = -*y3; | ||||
|         *y3 = x; | ||||
|     } | ||||
| 
 | ||||
|     void myInterpolateSup(float *x1, float *y1, float *x2, float *y2, float *x3, float *y3, float *x4, float *y4) | ||||
|     { | ||||
|         myInterpolate(x1, y1, x2, y2); | ||||
|         myInterpolate(x3, y3, x4, y4); | ||||
|         // rotation
 | ||||
|         qint32 x; | ||||
|         x = *x1; | ||||
|         *x1 = -*y1; | ||||
|         *y1 = x; | ||||
|         *x2 = -*x2; | ||||
|         *y2 = -*y2; | ||||
|         x = *x3; | ||||
|         *x3 = *y3; | ||||
|         *y3 = -x; | ||||
|     } | ||||
| 
 | ||||
| protected: | ||||
|     float m_even[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder];    // double buffer technique
 | ||||
|     float m_odd[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder];     // double buffer technique
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user