mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
Optimization: avoid cvtsd2ss instructions by using explicit floating point litterals. Spectrum histogram calculation optimization
This commit is contained in:
parent
7a798f7dbf
commit
7742c0de2d
@ -71,7 +71,7 @@ void ChannelAnalyzer::feed(const SampleVector::const_iterator& begin, const Samp
|
||||
|
||||
for(SampleVector::const_iterator it = begin; it < end; ++it)
|
||||
{
|
||||
Complex c(it->real() / 32768.0, it->imag() / 32768.0);
|
||||
Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
if (m_ssb)
|
||||
|
@ -247,7 +247,7 @@ void LoRaDemod::feed(const SampleVector::const_iterator& begin, const SampleVect
|
||||
|
||||
for(SampleVector::const_iterator it = begin; it < end; ++it)
|
||||
{
|
||||
Complex c(it->real() / 32768.0, it->imag() / 32768.0);
|
||||
Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
if(m_interpolator.interpolate(&m_sampleDistanceRemain, c, &ci))
|
||||
|
@ -85,7 +85,7 @@ void TCPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
int rescale = 30000 * (1 << m_boost);
|
||||
|
||||
for(SampleVector::const_iterator it = begin; it < end; ++it) {
|
||||
Complex c(it->real() / 32768.0, it->imag() / 32768.0);
|
||||
Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
if(m_interpolator.interpolate(&m_sampleDistanceRemain, c, &ci)) {
|
||||
|
@ -80,7 +80,7 @@ void WFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
for (SampleVector::const_iterator it = begin; it != end; ++it)
|
||||
{
|
||||
Complex c(it->real() / 32768.0, it->imag() / 32768.0);
|
||||
Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
rf_out = m_rfFilter->runFilt(c, &rf); // filter RF before demod
|
||||
|
@ -90,7 +90,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
||||
|
||||
for(int i = 0; i < count; ++i)
|
||||
{
|
||||
*it++ = Complex(begin->real() / 32768.0, begin->imag() / 32768.0);
|
||||
*it++ = Complex(begin->real() / 32768.0f, begin->imag() / 32768.0f);
|
||||
++begin;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||
|
||||
for (std::size_t i = 0; i < samplesNeeded; ++i, ++begin)
|
||||
{
|
||||
*it++ = Complex(begin->real() / 32768.0, begin->imag() / 32768.0);
|
||||
*it++ = Complex(begin->real() / 32768.0f, begin->imag() / 32768.0f);
|
||||
}
|
||||
|
||||
// apply fft window (and copy from m_fftBuffer to m_fftIn)
|
||||
@ -141,7 +141,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||
// not enough samples for FFT - just fill in new data and return
|
||||
for(std::vector<Complex>::iterator it = m_fftBuffer.begin() + m_fftBufferFill; begin < end; ++begin)
|
||||
{
|
||||
*it++ = Complex(begin->real() / 32768.0, begin->imag() / 32768.0);
|
||||
*it++ = Complex(begin->real() / 32768.0f, begin->imag() / 32768.0f);
|
||||
}
|
||||
|
||||
m_fftBufferFill += todo;
|
||||
|
@ -353,14 +353,15 @@ void GLSpectrum::updateHistogram(const std::vector<Real>& spectrum)
|
||||
quint8* b = m_histogram;
|
||||
quint8* h = m_histogramHoldoff;
|
||||
int sub = 1;
|
||||
int fftMulSize = 100 * m_fftSize;
|
||||
|
||||
if(m_decay > 0)
|
||||
sub += m_decay;
|
||||
|
||||
m_histogramHoldoffCount--;
|
||||
if(m_histogramHoldoffCount <= 0) {
|
||||
for(int i = 0; i < 100 * m_fftSize; i++) {
|
||||
if(*b > 20) {
|
||||
for(int i = 0; i < fftMulSize; i++) {
|
||||
if((*b>>4) > 0) { // *b > 16
|
||||
*b = *b - sub;
|
||||
} else if(*b > 0) {
|
||||
if(*h >= sub) {
|
||||
|
Loading…
Reference in New Issue
Block a user